diff --git a/README.md b/README.md index 6764411..56cb276 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ install commandbox-codechecker ## Usage - To start a code review against your code, run this command: ```bash @@ -30,56 +29,58 @@ codechecker run * **categories** - Comma delimited list of categories of rules to run. Applies on top of existing include and excludes specified in `.codechecker.json`. * **paths** - Comma delimited list of file globbing paths to scan. i.e. **.cf? (overrides `paths` in JSON) * **excludePaths** - Comma delimited list of file globbing paths to ignore -* **minSeverity** - Minimum rule severity to consider. Level 1-5 with 5 being most severe. (overrides `paths` in JSON) +* **minSeverity** - Minimum rule severity to consider. Level 1-5 with 5 being most severe. (overrides `minSeverity` in JSON configuration) * **excelReportPath** - Path to write Excel report to * **verbose** = "false" - Output full list of files being scanned and all items found to the console * **failOnMatch** = "false" - Sets a non-zero exit code if any matches are found +* **jsonFormatter** - jsonFormatter used to render the report, currently only accepted value is `codeclimate` and will provide a gitlab compatible json report +* **jsonOutput** = "codechecker.json" - Path to write json report to ### JSON Configuration If a `.codechecker.json` file is found in the current working directory, it will be picked up and used. This file can contain the following keys: -- **paths** - Comma delimited list of file globbing paths to scan if nothing is passed to the command +* **paths** - Comma delimited list of file globbing paths to scan if nothing is passed to the command * **excludePaths** - Comma delimited list (or array) of file globbing paths to ignore -- **minSeverity** - Minimum rule severity to consider if nothing is passed to the command -- **includeRules** - A struct of arrays where each struct key is a rule category and the array contains rule names to run. Instead of an array, the value in the struct can also be the string `"*"` which will include all rules in that category -- **excludeRules** - Same format as includeRules but these rules are EXCLUDED from the final list. -- **ruleFiles** - Array of absolute or relative (to the JSON file) paths to JSON files containing an arary of structs defining rules to run -- **customRules** - An array of structs defining rules to run. +* **minSeverity** - Minimum rule severity to consider if nothing is passed to the command +* **includeRules** - A struct of arrays where each struct key is a rule category and the array contains rule names to run. Instead of an array, the value in the struct can also be the string `"*"` which will include all rules in that category +* **excludeRules** - Same format as includeRules but these rules are EXCLUDED from the final list. +* **ruleFiles** - Array of absolute or relative (to the JSON file) paths to JSON files containing an arary of structs defining rules to run +* **customRules** - An array of structs defining rules to run. Here is an example `.codechecker.json` file: ```js { - "paths" : "**.cf?", - "excludePaths" : "modules/,test**", - "minSeverity" : 1, - "includeRules" : { - "Maintenance" : "*", - "Security Risks - Best Practices" : "*", - "One-off Rules" : "*", - "Standards" : [ - "Don't use IS or GT for boolean tests" - ] - }, - "excludeRules" : { - "Maintenance" : [ - "Don't use Log" - ] - }, - "ruleFiles" : [ - "myRules.json" - ], - "customRules" : [ - { - "pattern": "cfoutput", - "message": "CFoutput is lame", - "category": "One-off Rules", - "name": "Don't use CFoutput", - "extensions": "cfm,cfc", - "severity": "3" - } - ] + "paths" : "**.cf?", + "excludePaths" : "modules/,test**", + "minSeverity" : 1, + "includeRules" : { + "Maintenance" : "*", + "Security Risks - Best Practices" : "*", + "One-off Rules" : "*", + "Standards" : [ + "Don't use IS or GT for boolean tests" + ] + }, + "excludeRules" : { + "Maintenance" : [ + "Don't use Log" + ] + }, + "ruleFiles" : [ + "myRules.json" + ], + "customRules" : [ + { + "pattern": "cfoutput", + "message": "CFoutput is lame", + "category": "One-off Rules", + "name": "Don't use CFoutput", + "extensions": "cfm,cfc", + "severity": "3" + } + ] } ``` diff --git a/commands/codechecker/codeclimate.cfc b/commands/codechecker/codeclimate.cfc index 2e94ef4..d77026c 100644 --- a/commands/codechecker/codeclimate.cfc +++ b/commands/codechecker/codeclimate.cfc @@ -23,7 +23,8 @@ component { 'lines': { 'begin': result.lineNumber } - } + }, + 'fingerprint': hash('#replace(result.directory & result.file, filesystemUtil.resolvePath(''), '')#:#result.lineNumber#@#result.severity#!#result.rule#', 'md5') }; } ); }