Code Monkey home page Code Monkey logo

ramllint's Introduction

Build Status Coverage Status Codacy Badge Code Climate Dependency Status License Type

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('./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
  }
});

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.

ramllint's People

Contributors

blindscreen avatar jkalis-rm avatar kalisjoshua avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.