0.0.12 • Published 10 years ago

compliancejs v0.0.12

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

#ComplianceJS

JavaScript coding best practices validator written with NodeJS.

##Status

Alpha

##Features

  • Write your own rules
  • Write your own plugins
  • Write your own report templates

##Install

npm install -g compliancejs

Dependencies

##Usage

compliance [--verbose] [--config=config-file]

--config is an optional parameter where compliance options are configured. If --config is not present, the application will look for compliance-config.json in the directory where the command was issued.

--verbose optional parameter to show all console logs.

##Configuration

Configuration is JSON formatted text file with the following table of keys.

KeyValue TypeRequiredDefaultDescription
filesArray of StringYesThis is an array of path pointing to the files that needs to be validated. You can use abosulte or glob pattern for the filename.
reportsArray of JSON ObjectNoReports configuration
ignoreRuleFileErrorbooleanNotrueIf set to false, ComplianceJS will stop and throw exception when error is detected from rule files.
excludeJSON ObjectNoExclude some rules from being validated against the files configured in "files".
rulesArray of StringNorules/**An array of path pointing to the files that contains the rule definition. Values can be absolute or glob pattern.
pluginsArray of StringNoplugins/**An array of path pointing to the files that contains plugin codes. Values can be absolute or glob pattern.

###Key "reports"

KeyValue TypeRequiredDefaultDescription
templateStringYesReport template name
typeStringYesReport format. Supports the following values : html or text
distStringYesThe path to where the reports will be generated.

###Key "exclude"

KeyValue TypeRequiredDefaultDescription
Rule Collection NameArray of StringYesKey is dynamic and must be the rule collection name defined in the rule file. The values for this key must be the name or id of the rule that needs to be excluded.

###Configuration File Example compliance-config.json

{
    
    "plugins" : [
      "plugins/**/*.js"
    ],
    
    "rules" : [
      "rules"
    ],
    
    "exclude" : {
        "Basic" : ["eqeqeq"]
    },
    
    "files" : [
        "test/**/*.js"
    ],
    
    "reports" : [
        {
            "template" : "default",
            "type"  : "html",
            "dist" : "reports"
        }
    ], 
    
    "ignoreRuleFileError" : true,
    
    "overrides" : [
        {
            "group" : "Basic", 
            "id" : "maxComplexity",
            "param" : {"max" : 8}
        }
    ]
}

##How to create and add your custom rules?

See Writing Custom Rules

##How to create and add your own plugins?

##Report Template

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago