Skip to main content

Identifying the highest threats to your code quality by analyzing code metrics of your project using pytest and pylint.

Project description

CodeRadar

Identifying the highest threats to your code quality by analyzing code metrics of your project using pytest and pylint.

Status: Beta (runs, but certainly has bugs)
Authors: Carsten König

Purpose

In order to quickly see where an existing project needs refactoring, an overview of the worst code smells is needed. This package therefore summarizes these in a very brief report, that should guide you directly to the places in your software where an improvement would have the highest impact when you want to improve code quality.

CodeRadar investigates the results from Pytest and Pylint and summarizes the most important findings in a report with actionable hints that are prioritized for the best return on investment regarding your time: fixing the locations pointed out by CodeRadar will improve your code quality the most. If you fix one after the other, you will be able to improve your code step by step, with the highest impact fixes first. In order to give you feeling of progress, changes of the code quality are also indicated in the code quality report.

When run under Python 2.7 (yes, there is still legacy code out there that needs to be ported to Python 3), CodeRadar also points out Python 2/3 compatibility issues (but here in no specific order, as all of them need to be addressed).

The code quality report is available in HTML and TXT format - the latter is printed on the console when you run CodeRadar. Here is an example of the console output for a previous version of CodeRadar:

Code Quality Report
coderadar
--------------------------------------------------
Pytest:
  Number of tests: 31 (+24)
           errors: 0 (+0)
  Test coverage: 42% (+26%)

--------------------------------------------------
Pylint Score:   4.20/10 (+0.36)
  Missing docstrings:             21 (+21)

  Needs Refactoring:
    Too complex:                  0 (+0) (max cyclomatic complexity=0 (+0))
                                    :  (line )
    Function too long (LoC/func): 1 (+1) (max LoC/func=60 (+60))
                                    report.py: Report._fillTemplate (line 194)
    Duplicate code:               0 block(s) (+0)
                                    0 lines in 0 modules:
                                    

  Obsolete code:
    Unused imports:             0 (+0)
                                  
                                  0 imports: 
    Unused variables:           0 (+0)
                                  
                                  0 variables: 
    Unused arguments:           1 (+0)
                                  report.py
                                  1 arguments: 'Report.getReportTemplate(coverage)' (l:105)
    Unreachable code:           0 (+0)
                                  
                                  0 block(s): 

--------------------------------------------------

And here is an image of the same code quality report in HTML format: CodeRadar HTML code quality report

Installation

pip install coderadar

How to use

In order to analyze your sourcecode, go to your project root folder and run

coderadar <path-to-source>

This will run pytest, pylint and flake8 to get the metrics that will be analyzed.

The following artifacts will be created:

  • coverage.xml
  • coverage.txt
  • pylint.json
  • pylint.txt
  • code_quality_report.html
  • code_quality_report.txt

If you run coderadar under Python 2.7, the following artifacts will be created additionally, in order to assess Python 3 compatibility:

  • pylint_py3.json
  • pylint_py3.txt

If you place these artifacts in a folder called last_run, located in the directory where you run the command, the results of the last run are automatically compared to the current run.

How to contribute

No, CodeRadar itself, although developed in a (partially) test-driven manner, and being all about code quality, is also not a perfect piece of code (ironic, isn't it?). Feel free to suggest new features, report bugs or even contribute code. I would be happy to see this project grow and improve with your help.

License

GNU GPLv3 License

Author

Carsten König

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coderadar-0.5.8.tar.gz (128.3 kB view details)

Uploaded Source

Built Distribution

coderadar-0.5.8-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file coderadar-0.5.8.tar.gz.

File metadata

  • Download URL: coderadar-0.5.8.tar.gz
  • Upload date:
  • Size: 128.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for coderadar-0.5.8.tar.gz
Algorithm Hash digest
SHA256 bdaf7f5171bfc2638053fc38172804f554902ce207d2e85c657fbe7b66718713
MD5 6fa3c7c719d58eccbcf81345ef9f0f11
BLAKE2b-256 7fcc543ed11f20410c37c43d41313dec89e43d62542f60b1bf6f1cb9d25e2cd4

See more details on using hashes here.

File details

Details for the file coderadar-0.5.8-py3-none-any.whl.

File metadata

  • Download URL: coderadar-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for coderadar-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 54eb67bbcd37634ea40dd5389c06cfa48e6741567dfd622112d5e131153221a0
MD5 85e8152183efe0b52fecc0f73efe82c3
BLAKE2b-256 b08519ac12e31147f8c83e37cc3efbd6c16e9941b64a481696db713a0b0119a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page