cogito 1.2.0

Cognitive Complexity code metric for D


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

CI License

cōgitō

cōgitō analyses D code and calculates its [cognitive complexity].

Installing and usage

Run make install build/release/bin/cogito.

It will download and install the frontend and build a binary. Then you can run it on some D source:

Run ./build/release/bin/cogito src/main.d.

Example output

module app: 5 (src/main.d)
accumulateResult: 5 (src/main.d:9)
accumulateResult.(λ): 0 (src/main.d:12)
accumulateResult.(λ): 2 (src/main.d:16)
(λ): 0 (src/main.d:33)

Command line options

Property nameAllowed valuesDescription
--thresholdPositive numbersFail if the source score exceeds this threshold.
--module-thresholdPositive numbersFail if a function score exceeds this threshold.
--formatflat, verbose and silentFlat format outputs all functions with their source file name and line number. Verbose output adds column numbers and scores inside aggregates. Silent format produces no output, but returns an error if one of the thresholds is exceeded.
--helpShow a help message.

Return codes

The return code of the program provides some information on what kind of error occurred.

  • 0: Success
  • 1: Command line arguments are invalid
  • 2: Some source files contain errors
  • 3: Threshold violation
Authors:
  • Eugen Wissner
Dependencies:
argparse
Versions:
1.4.0 2022-Jun-10
1.3.1 2022-May-15
1.3.0 2022-May-14
1.2.0 2022-Apr-23
1.1.0 2022-Apr-10
Show all 8 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 1 downloads this month

  • 12 downloads total

Score:
0.2
Short URL:
cogito.dub.pm