https://www.youtube.com/watch?v=G1lDk_WKXvY
In this post I document a few software tools I used.
Pylint
$ pylint interactive_user_prompt.py --disable bad-whitespace,missing-docstring,superfluous-parens,bad-indentation,line-too-long,trailing-whitespace,len-as-condition,too-many-locals,invalid-name,too-many-branches,too-many-return-statements,too-many-statements --reports=n
and flake8
$ flake8 --ignore=E111,E225,E231,E501,E226,W291,E221,E115,E201,W293,E261,E302,E265 interactive_user_prompt.py
Not surprisingly, some of my functions are complicated (a score of greater than 10 is frowned upon)
$ python -m mccabe --min 9 interactive_user_prompt.py | wc -l
15
$ python -m mccabe --min 15 interactive_user_prompt.py | wc -l
4
So 15 functions scored 9 or greater; 4 functions were 15 or higher!
That's out of 50 functions and 1946 lines of Python (including comments and blank lines) $ cat interactive_user_prompt.py | wc -l
1946
$ cat interactive_user_prompt.py | grep "^def " | wc -l
50
Although I'm not concerned about security of a locally run Python script, I also tried bandit:
$ bandit -r interactive_user_prompt.py
which complained about my use of the shell.
I'm aware of autopep8 but haven't used it yet.
No comments:
Post a Comment