Garpix QA
Checking the Django project for quality. It can be convenient if you include it in CI.
Used packages:
- django unittest - unit testing in Django.
- flake8 - linter of source code.
- radon - tool that computes various metrics from the source code.
- bandit - a security linter from PyCQA.
Quickstart
Install with pip:
pip install garpix_qa
Add the garpix_qa to your INSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
# ...
'garpix_qa',
]
To use Lighthouse scoring, install Lighthouse CI with npm:
npm install -g @lhci/cli
Check your project:
python manage.py qa
Check your project with Lighthouse CI:
(requires Lighthouse CI installed)
python manage.py qa -a
python manage.py qa --all
Optionally, do not save Lighthouse CI report files:
python manage.py qa --all --clear-reports
Check your project with all logs:
python manage.py qa --verbose
Example output with OK
Input
Directory: /Users/aleksejkuznecov/projects/garpix_packages/garpix-qa/backend
Start at: 2021-02-27 12:09:30.999142
Checking
Checking style guide with flake8 (see ".flake8") OK
Django unit tests OK
Cyclomatic complexity with radon (see "radon.cfg") OK
Security lint with bandit (only high-severity issues, see ".bandit") OK
Result
Problems found: 0
End at: 2021-02-27 12:09:33.789880
Duration: 0:00:02.790738
Example output with problems
Input
Directory: /Users/aleksejkuznecov/projects/garpix_packages/garpix-qa/backend
Start at: 2021-02-27 12:23:41.066752
Checking
Checking style guide with flake8 (see ".flake8") ERROR
/Users/aleksejkuznecov/projects/garpix_packages/garpix-qa/backend/garpix_qa/constants.py:18:4: W292 no newline at end of file
/Users/aleksejkuznecov/projects/garpix_packages/garpix-qa/backend/garpix_qa/helpers.py:38:1: E302 expected 2 blank lines, found 1
/Users/aleksejkuznecov/projects/garpix_packages/garpix-qa/backend/garpix_qa/colors.py:9:1: W391 blank line at end of file
Django unit tests OK
Cyclomatic complexity with radon (see "radon.cfg") OK
Security lint with bandit (only high-severity issues, see ".bandit") ERROR
[main] INFO Found project level .bandit file: /Users/aleksejkuznecov/projects/garpix_packages/garpix-qa/backend/.bandit
[main] INFO profile include tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: None
[main] INFO running on Python 3.8.2
Run started:2021-02-27 12:23:45.044503
Test results:
>> Issue: [B602:subprocess_popen_with_shell_equals_true] subprocess call with shell=True identified, security issue.
Severity: High Confidence: High
Location: /Users/aleksejkuznecov/projects/garpix_packages/garpix-qa/backend/garpix_qa/helpers.py:39
More Info: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html
38 def shell_run(cmd):
39 ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
40 lines = ps.communicate()[0]
--------------------------------------------------
Code scanned:
Total lines of code: 285
Total lines skipped (#nosec): 0
Run metrics:
Total issues (by severity):
Undefined: 0.0
Low: 1.0
Medium: 0.0
High: 1.0
Total issues (by confidence):
Undefined: 0.0
Low: 0.0
Medium: 0.0
High: 2.0
Files skipped (0):
Result
Problems found: 2
End at: 2021-02-27 12:23:45.098015
Duration: 0:00:04.031263
Configure Lighthouse CI
Edit lighthouserc.json to set URL and configure assertions.
Reference: https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md
Changelog
See CHANGELOG.md.
Contributing
See CONTRIBUTING.md.
License
Developed by Garpix / https://garpix.com
Metadata
Release files for garpix-qa 1.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| garpix_qa-1.10.0.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| garpix_qa-1.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.7 kB
Release files / garpix_qa-1.10.0.tar.gz
| Download URL | garpix_qa-1.10.0.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d57b21749dcf6d9797aa4df11be3c9f928364122d636866f778b066d72fa19c0
|
|
BLAKE2b-256 checksum How to use checksums |
89f3e621039002292d562bb15ba08143e3cef4743af7e0e7023ba773c911b796
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.13
|
Release files / garpix_qa-1.10.0-py3-none-any.whl
| Download URL | garpix_qa-1.10.0-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6efb1bad2ce987f7760342b1b946a170de8b660b203e5dde3a715bad8e1ea1d
|
|
BLAKE2b-256 checksum How to use checksums |
03eeffb12397ee9be619c8ea1e827b740d302d91999cc129c0ff79aa0bd56650
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.13
|