I want to calculate Cyclomatic Complexity by using PyLint. I need to have a python script that calculates the complexity of many modules at once.
I have tried using command as well as through python program.
This is the command i'm using:
pylint shortQuestion.py --load-plugins=pylint.extensions.mccabe
This is the code i'm using in python:
import pylint.lint
pylint_opts = ['basics.py','--load-plugins=pylint.extensions.mccabe','--rcfile=~/.pylintrc']
pylint.lint.Run(pylint_opts)
Here is the result i get from the command and code:
Using config file /var/root/.pylintrc
************* Module shortQuestion
W: 5, 0: Found indentation with tabs instead of spaces (mixed-indentation)
W: 6, 0: Found indentation with tabs instead of spaces (mixed-indentation)
W: 7, 0: Found indentation with tabs instead of spaces (mixed-indentation)
W: 8, 0: Found indentation with tabs instead of spaces (mixed-indentation)
C: 1, 0: Module name "shortQuestion" doesn't conform to snake_case naming style (invalid-name)
C: 1, 0: Missing module docstring (missing-docstring)
C: 4, 0: Function name "isContained" doesn't conform to snake_case naming style (invalid-name)
C: 4, 0: Missing function docstring (missing-docstring)
R: 5, 1: Unnecessary "else" after "return" (no-else-return)
W: 4,16: Unused argument 'cls' (unused-argument)
----------------------------------------------------------------------
Your code has been rated at -15.00/10 (previous run: 10.00/10, -25.00)
is the -15.00/10 Cyclomatic Complexity here? If yes, how can i get the output in formatted way? Since i need to calculate this complexity for many python modules at once. If not, how can i calculate this?