Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 38 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ install commandbox-codechecker

## Usage


To start a code review against your code, run this command:

```bash
Expand All @@ -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"
}
]
}
```

Expand Down
3 changes: 2 additions & 1 deletion commands/codechecker/codeclimate.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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')
};
} );
}
Expand Down