Automated Code Reviews for Python¶
Scrutinizer provides first-class analysis of Python code. We infer a default configuration for you. You can tweak the
defaults by placing a .scrutinizer.yml
in your project's root folder.
Automated Checks¶
By default, we enable code rating, code metrics and duplicate code detection for Python. Besides, we also support all checks provided by Pylint such as PEP8 coding style checks, unused code detection, and more.
Code Rating and Duplicate Code Detection¶
checks:
python:
code_rating: true
duplicate_code: true
build:
nodes:
analysis:
tests:
override:
- py-scrutinizer-run
To make finding the right checks easier, we provide a checks editor
that you can use and which generates the configuration for you. You can then place the generated Yaml configuration
in your .scrutinizer.yml
in your project's root folder.
pylint¶
If you have already created a .pylintrc
configuration file, you can enable pylint
in your .scrutinizer.yml
:
build:
tests:
override:
- pylint-run [file|module_or_package]
If you do not have a .pylintrc
, our checks editor makes it very easy
to create one, and comes with examples and descriptions of the different checks that are available.
Analyzed Files¶
By default, Scrutinizer will analyze all files ending with .py
in your project. If you have generated code, or dependencies
embedded in your project, or would like to exclude your tests from the analysis, this can be achieved easily:
filter:
excluded_paths:
- tests/*
Learn more in our configuration reference about advanced filtering techniques.
Code Coverage¶
Scrutinizer can process your code coverage that was generated on an external CI service. Simply update your configuration and your third-party service to send us the coverage data.
Changes to Scrutinizer configuration¶
tools:
external_code_coverage:
timeout: 300 # How long should we wait for code coverage (in seconds).
runs: 1 # In how many runs have you split your tests?
Changes to external CI configuration¶
pip install scrutinizer-ocular
ocular --access-token "your-token" --data-file ".coverage" --config-file ".coveragerc"
--access-token
option. For private repositories, you can generate
an access token on your profile page - make sure to create it with
READ
access only.