Kwalitee package¶
Command line interface¶
Configuration¶
kwalitee base configuration.
To change it, put a config.py into your instance.
-
kwalitee.config.CONTEXT¶ Context for Github.
See also
-
kwalitee.config.COMPONENTS¶ List of supported components.
See also
-
kwalitee.config.ACCESS_TOKEN¶ Github access token. Used to post statuses and comments. It MUST be set.
-
kwalitee.config.AUTO_CREATE¶ Allow anyone to add its repository by setting up the webhook on Github.
Default:
False
-
kwalitee.config.CHECK_COMMIT_MESSAGES¶ Enable the
commit message checks.Default:
True
-
kwalitee.config.CHECK_WIP¶ Enable the work-in-progress pull requests checks. Disabled by default.
Default:
False
-
kwalitee.config.CHECK_LICENSE¶ Enable the
license checks.Default:
True
-
kwalitee.config.CHECK_PEP8¶ Enable the
PEP8 checks.Default:
True
-
kwalitee.config.CHECK_PYDOCSTYLE¶ Enable the
PYDOCSTYLE checks.Default:
True
-
kwalitee.config.CHECK_PYFLAKES¶ Enable the PyFlakes checks. PEP8 checks are required.
Default:
True
-
kwalitee.config.IGNORE¶ Error codes to ignore.
Default:
['E123', 'E226', 'E24', 'E501', 'E265']
-
kwalitee.config.SELECT¶ Error codes to specially enable.
Default:
[]
-
kwalitee.config.WORKER_TIMEOUT¶ Background worker job time window.
Any job taking longer than that will be killed.
RQ default timeout is 180 seconds
-
kwalitee.config.MIN_REVIEWERS¶ Minimum number of reviewers for py:func:message check <.kwalitee.check_message>.
Default: 3
-
kwalitee.config.LABEL_WIP¶ Label to apply for a work-in-progress pull request.
Default:
"in_work"
-
kwalitee.config.LABEL_REVIEW¶ Label to apply for a pull request that needs more reviewers.
Default:
"in_review"
-
kwalitee.config.LABEL_READY¶ Label to apply for a pull request that passes all the checks.
Default:
"in_integration"
-
kwalitee.config.EXCLUDES¶ List of regex of excluded files.
Default:
[]
-
kwalitee.config.AUTHORS¶ List of filenames containing authors and contributors.
Default:
['AUTHORS.rst',]
-
kwalitee.config.EXCLUDE_AUTHOR_NAMES¶ List of author names to be excluded from checking (e.g. known second email addresses).
Default:
[]
-
kwalitee.config.ALT_SIGNATURES= ('Reported-by',)¶ Alternative signatures recognized but not counted as reviewers.
-
kwalitee.config.COMMIT_MSG_TEMPLATE= '{component}: description (max 50 chars, using nouns)\n\n* Detailed description formatted as a bullet list (using present tense).\n\nSigned-off-by: {author}\n{extra}'¶ Template used to generate the commit message from the git hook.
-
kwalitee.config.GITHUB= 'https://github.com/'¶ Github base URL.
-
kwalitee.config.GITHUB_REPO= 'https://github.com/{account}/{repository}/'¶ Github repository URL template.
-
kwalitee.config.PYDOCSTYLE_MATCH= '(?!test_).*\\.py'¶ Files checked for PYDOCSTYLE conformance.
-
kwalitee.config.PYDOCSTYLE_MATCH_DIR= '[^\\.].*'¶ Directories checkes for PYDOCSTYLE conformance.
-
kwalitee.config.SIGNATURES= ('Signed-off-by', 'Co-authored-by', 'Tested-by', 'Reviewed-by', 'Acked-by')¶ Authors and reviewers signatures.
-
kwalitee.config.TRUSTED_DEVELOPERS= []¶ Super developers who’s code never fail.
Hooks¶
Git hooks.
Checks¶
Kwalitee checks for PEP8, PYDOCSTYLE, PyFlakes and License.
-
kwalitee.kwalitee.SUPPORTED_FILES= ('.py', '.html', '.tpl', '.js', '.jsx', '.css', '.less')¶ Supported file types.
Check the presence of the author in the AUTHORS/THANKS files.
Rules:
- the author full name and email must appear in AUTHORS file
Parameters: - authors (list) – name of AUTHORS files
- path (str) – path to the repository home
Returns: errors
Return type: list
-
kwalitee.kwalitee.check_file(filename, **kwargs)[source]¶ Perform static analysis on the given file.
See also
Parameters: filename (str) – path of file to check. Returns: errors sorted by line number or None if file is excluded Return type: list
-
kwalitee.kwalitee.check_license(filename, **kwargs)[source]¶ Perform a license check on the given file.
The license format should be commented using # and live at the top of the file. Also, the year should be the current one.
Parameters: Returns: errors
Return type: list
-
kwalitee.kwalitee.check_message(message, **kwargs)[source]¶ Check the message format.
Rules:
- the first line must start by a component name
- and a short description (52 chars),
- then bullet points are expected
- and finally signatures.
Parameters: - components (list) – compontents, e.g.
('auth', 'utils', 'misc') - signatures (list) – signatures, e.g.
('Signed-off-by', 'Reviewed-by') - alt_signatures (list) – alternative signatures, e.g.
('Tested-by',) - trusted (list) – optional list of reviewers, e.g.
('john.doe@foo.org',) - max_length (int) – optional maximum line length (by default: 72)
- max_first_line (int) – optional maximum first line length (by default: 50)
- allow_empty (bool) – optional way to allow empty message (by default: False)
Returns: errors sorted by line number
Return type: list
-
kwalitee.kwalitee.check_pep8(filename, **kwargs)[source]¶ Perform static analysis on the given file.
Parameters: Returns: errors
Return type: list
See also
Module contents¶
Tool for checking commit kwalitee.