The wily diff command will compare the last cached revision of the code with the current metrics. It will run the default metrics for the current environment.
To see the changes in metrics for a list of files, give the files to the
wily diff command.
$ wily diff example.py example2.py src/example3.py
The diff command will only show files where the metrics have changes, to see all files regardless of changes, provide the
$ wily diff example.py --all
To show specific metrics, add a combination of comma-separated
$ wily diff example.py --metrics raw.loc,cyclomatic.complexity
Diff will show function and class-level metrics by default. To show only module-level metrics, add the
$ wily diff example.py --no-detail
Using diff as a pre-commit hook¶
You can install wily as a pre-commit plugin by adding the following configuration to
repos: - repo: local hooks: - id: wily name: wily entry: wily diff verbose: true language: python additional_dependencies: [wily]
Command Line Usage¶
Show the differences in metrics for each file.
wily [OPTIONS] FILES...
- -m, --metrics <metrics>¶
comma-seperated list of metrics, see list-metrics for choices
- -a, --all, -c, --changes-only¶
Show all files, instead of changes only
- --detail, --no-detail¶
Show function/class level metrics where available
- -r, --revision <revision>¶
Compare against specific revision