npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ramllint

v1.2.6

Published

RAML Lint

Downloads

33

Readme

Build Status Coverage Status Codacy Badge Code Climate Dependency Status License Type Join the chat at https://gitter.im/QuickenLoans/ramllint

NPM

RAML is a language for modeling RESTful APIs. By design, it does not enforce any style rules on how to consistently document APIs, because not all projects will require the same level of rule enforcement. However, it can often be useful to enforce uniform rules and standards across a group of related APIs to ensure consistency and uniformity across multiple teams or business units.

RAML Linter is a static analysis, linter-like, utility that will enforce rules on a given RAML document, ensuring consistency and quality.

Installing

npm install -g ramllint

Using the Linter

RAML Linter can be used either as a library or as a command line utility.

Library

Using the library in code provides the most flexibility, offering error handling and the ability to parse the full results for: error, warning, and info log entries.

var Linter = require('ramllint'),

    ramllint = new Linter();

ramllint.lint('./path/to/api.raml', function (results) {
   // NOTE: results will only contain 'error' and will exclude 'warning' and 'info'
   // to get an array of all log entries use: `ramllint.results()`

  if (!results.length) {
    // no errors, all rules are satisfied
  } else {
    // errors
  }
});

Rules

The default rules are included in the src/defaults.json file. You can make adjustments to the test used in the rule by passing options to the Linter constructor.

For example, if you'd like to change the rules for URL validation to permit /sticky-wickets and /{stickyWicketId}, you can do this:

var Linter = require('ramllint'),
    options = {
        'url_lower': '^\\/([a-z]+(-[a-z]+)*|{[a-z]+([A-Z][a-z]+)*})$'
    },
    ramllint = new Linter(options);

Options need to be a JSON object with keys that match an id from the defaults.json file and values that are strings or string RegExp patterns.

Command Line

If you are in the same directory as your RAML document:

ramllint

If your RAML document is in another directory:

ramllint path/to/api.raml

Note: specifying the file (second example above) might be necessary for some OSes.

(npm) Scripts

Below is a list of commands available via npm run for you convenience:

  • npm run cover for TravisCI only
  • npm run doc
    1. Remove the docs/ directory to start clean
    2. Generate documentation pages (JSDoc) in docs/
    3. Create code coverage report (Istanbul) docs/coverage/lcov-report/
    4. Create code statistics report (Plato) docs/coverage/
  • npm run doc:pub for publishing docs/ to gh-pages
  • npm run lint - static code analysis and code style linting
    1. JShint
    2. ESlint
  • npm run quality - runs lint and code coverage
  • npm test - runs unit tests (Mocha)
  • npm run watch - watches test/ and src/ for changes and re-runs tests

Documentation

  1. Code Documentation
  2. Code Coverage Report
  3. Static Code Analysis

Contributing

  1. Fork this repository
  2. git clone
  3. npm install
  4. Create a working branch
  5. Write code and tests
  6. Submit Pull Request

This project aims to maintain a high level of unit test code coverage. All pull requests must be accompanied by appropriate test cases, and all tests must pass in order to be considered for merge.

For detailed rules on contributions, please refer to our contribution guidelines.