No project description provided
Project description
cg-flake8-reporter
A Flae8 reporter plugin for CodeGrade AutoTest v2.
This plugin writes messages to CodeGrade AutoTest v2's structured output channel.
For each violation Flake8 reports, a comments
message is written as described
in CodeGrade's documentation. When Flake8 finishes its analysis, a final message
is written with the amount of points that were achieved in the code quality run.
Configuration
In order to use the custom reporter, make sure you have installed both Flake8 and this package:
python3 -m pip install flake8==6.0.0
python3 -m pip install cg-flake8-reporter
This reporter is registered with Flake8 as cg-flake8-reporter
, to use it run
flake with the option --format=cg-flake8-reporter
.
The custom reporter adds a few new options to Flake8: cg-points-deducted
,
cg-flake8-fd
and cg-base-path
.
cg-points-deducted
The cg-points-deducted
option makes it possible to configure the amount of
points (in percentage) that each violation deducts from the total points.
The cg-points-deducted
expectes a string in the following format as input:
'info:<percentage>,warning:<percentage>,error:<percentage>'
Each of the violation levels must be present in the provided string. The
percentage provided should be an integer number without the %
symbol.
If you wish for a violation level to not deduct points, simply set it to 0
.
cg-flake8-fd
The cg-flake8-fd
option makes it possible to configure where the reporter
will write its output. By default, the value is 1
, which means the reporter
will write to stdout
. Within AutoTest v2 it is recommended to use file
descriptor 3
so that the comments will be visible in CodeGrade's UI. The
Flake8 step will already set this up for you.
cg-base-path
The cg-base-path
allows you to restrict which files the reporter will report.
For example, if you only want files to be reported within the server
directory
of the student, you may want to set --cg-base-path=~/student/server/
. Beware,
the Flake8 step always sets cg-base-path
to the root of the student's
workspace. If you want to customize this, you should use a Custom Test step
instead.
Usage
To run Flake8 with the custom reporter:
python3 -m flake8 \
--format=cg-flake8-reporter \
--cg-points-deducted='info:1,warning:3,error:5' \
--cg-flake8-fd=1 \
./
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cg_flake8_reporter-2023.6.12.1304.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 237cd813eb089c25d2fff75b84c50dd495f775e631797ee46baaff33d651f0bd |
|
MD5 | 8966d8ef932efc6cbd8d89c80fcb6903 |
|
BLAKE2b-256 | efb6325b42c4275807ae2b3fa4e3c1e13eb13d82c6b56b568b933f17987aab3a |
Hashes for cg_flake8_reporter-2023.6.12.1304-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ed70150170441321d76b5d7b048b8bfd6069ac0de204f75d2438074b963890a |
|
MD5 | c0679b82617d6f15b996e949e217f386 |
|
BLAKE2b-256 | 442d650fb86555e13a7f29cda375b1bd3756a01677fbb95b35133bbf1aeee380 |