python-package-template icon indicating copy to clipboard operation
python-package-template copied to clipboard

Consider code complexity tracking, and other tools.

Open jenstroeger opened this issue 4 years ago • 10 comments

Tools like Wily and Radon allow to track code complexity metrics, e.g. based on cyclomatic complexity or Halstaed’s complexity metrics. It might make sense to track these (and other?) metrics to measure software maintainability.

In addition, e.g. ~Bandit~ or dlint might be useful additions?

jenstroeger avatar Oct 11 '21 20:10 jenstroeger

See also the Complexity section of Awesome flake8 plugins. There’s also the wemake-python-styleguide plugin which acts as a wrapper around a bunch of other tools and plugins

In addition, e.g. Bandit or dlint might be useful additions?

PR #214 adds Bandit as git commit hook.

jenstroeger avatar Jun 14 '22 05:06 jenstroeger

It probably makes sense to consider the pip-audit package too (see discussion).

jenstroeger avatar Jul 31 '22 22:07 jenstroeger

It probably makes sense to consider the pip-audit package too (see discussion).

Played around with it, and the tools looks useful:

> pip-audit 
Found 2 known vulnerabilities in 2 packages
Name     Version ID             Fix Versions
-------- ------- -------------- ------------
lxml     4.7.1   PYSEC-2022-230 4.9.1
waitress 2.1.1   PYSEC-2022-205 2.1.2

However, I wouldn’t use it as a commit hook because dependecies don’t change that often. Instead, it would probably make sense to add it to our Makefile:

https://github.com/jenstroeger/python-package-template/blob/c7541754294c634cd807068ffaf37bd0279cbb52/Makefile#L80-L86

Call git-audit right after the packages have been updated:

python -m pip_audit

However, if a pip-audit run fails then it fails setting up a venv during an Action run and thereby fails the Action 🤔

jenstroeger avatar Aug 06 '22 09:08 jenstroeger

Moving PR https://github.com/jenstroeger/python-package-template/pull/377 over here (and closing): I stumbled upon the dependency-review-action which looked useful. Not sure if build.yaml is a good place, or better pr-change-set.yaml. What do you think, @behnazh?

jenstroeger avatar Nov 21 '22 09:11 jenstroeger

Another tool too consider is guarddog.

behnazh avatar Nov 21 '22 22:11 behnazh

And then there’s super-linter, which looks rather interesting too 🤓

jenstroeger avatar Nov 22 '22 12:11 jenstroeger

pylint offers a number of optional checkers which we can review. I didn’t find a list of additional, third-party checkers though…

jenstroeger avatar Mar 13 '23 03:03 jenstroeger

There’s also Ruff which incorporates lint and flake and various checkers in one single tool.

jenstroeger avatar Apr 25 '23 10:04 jenstroeger

Another interesting tool is import-linter that checks if user-specified import contracts are met by the code.

jenstroeger avatar Nov 19 '23 03:11 jenstroeger

And perflint looks like a useful pylint plugin, too.

jenstroeger avatar Jan 02 '24 05:01 jenstroeger