Rank Command

The rank command will show a CLI table of files in order of their respective metric values. It is useful for identifying e.g. complex files.



To show all files in the index, simply use wily rank without arguments.

$ wily rank

To display a file ranking, simply provide the path to a directory.

$ wily rank src/

By default, wily will show the default metric (maintainability index).

To change the metric, provide the metric name (run wily list-metrics for a list) as argument.

$ wily rank src/ loc

Wily rank will show the last revision by default. If you want to show a specific revision, you can provide the reference of a revision via --revision.

$ wily rank src/ --revision HEAD^2

Wily rank will exit with 0 by default if no error occurs. However, you can set a custom threshold. If the total value is below the specified threshold, the rank command will return a non-zero exit code.

Command Line Usage


Rank files, methods and functions in order of any metrics, e.g. complexity.

Some common examples:

Rank all .py files within src/ for the maintainability.mi metric

$ wily rank src/ maintainability.mi

Rank all .py files in the index for the default metrics across all archivers

$ wily rank

Rank all .py files in the index for the default metrics across all archivers and return a non-zero exit code if the total is below the given threshold

$ wily rank –threshold=80



-r, --revision <revision>

Compare against specific revision

-l, --limit <limit>

Limit the number of results shown

--desc, --asc

Order to show results (ascending or descending)

--threshold <threshold>

Return a non-zero exit code under the specified threshold



Optional argument


Optional argument