Added Sorting & Filtering
What's Changed
New Features Added
- Sorting functionality with command-line options --sort-by and --sort-order
- 13 sortable fields: score, halstead, cyclomatic, class, method, lineCount, argCount, returnCount, variableCount, propertyCallCount, ifCount, ifNestingLevel, elseCount
- Sort orders: ascending (asc) and descending (desc) with asc as default
- Grouping by class via new groupByClass configuration option (default: true)
- Enhanced filtering with better handling of ignored items and method filtering
Configuration Changes
- Added groupByClass: true option to config.yml
- Updated ConfigFactory and ConfigLoader to support the new option
Enhanced CognitiveConfig class with groupByClass property
Documentation Updates
- https://github.com/Phauthentic/cognitive-code-analysis/blob/master/docs/Sorting-and-Filtering.md
- https://github.com/Phauthentic/cognitive-code-analysis/blob/master/docs/Configuration.md
Full Changelog: 1.3.0...1.4.0
Example
To generate the output below these settings were used in the config.yaml and this command executed bin/phpcca analyse ./src --sort-by=score --sort-order=desc
cognitive:
showOnlyMethodsExceedingThreshold: true
groupByClass: false