Linting your project#
Linting is the process of statically analyzing code to find code style violations and to detect errors. cookietemple implements a custom linting system, but depending on the template external tools linting tools may additionally be called.
cookietemple’s linting is divided into three distinct phases.
All linting functions, which all templates share are called and the results are collected.
Template specific linting functions are invoked and the results are appended to the results of phase 1
The linting results of the first two phases are assigned into 3 groups:
Passed
Passed with warning
Failed
If any of the checks failed linting stops and returns an error code.
To examine the reason for a failed linting test please follow the URL. All reasons are explained in the section Linting codes.
Usage#
cookietemple lint can be invoked on an existing project using
$ cookietemple lint <PATH>
PATH
[CWD]: The relative path to the project directory.
Flags#
Linting codes#
The following error numbers correspond to errors found during linting. If you are not sure why a specific linting error has occurred you may find more information using the respective error code.
General#
general-1#
general-2#
general-3#
COOKIETEMPLE TODO:
or TODO COOKIETEMPLE:
strings in the respective files. Usually, they point to things that should be
manually configured or require other attention. You may remove them if there is no task for you to be solved.general-4#
{{ *cookiecutter* }}
statements
should definitely not be present anymore.general-5#
cookietemple bump-version
.general-6#
changelog.rst
invalid. The changelog.rst
file requires that every changelog section has a header with the version and the corresponding release date.
The version above another changelog section should always be greater than the section below (e.g. 1.1.0 above 1.0.0).
Every section must have the headings **Added**
, **Fixed**
, **Dependencies**
and **Deprecated**
.general-7#
cookietemple.cfg
linting failed. The cookietemple.cfg
plays a major role in cookietemple’s sync
and bump-version
functionality.The linter ensures that following requirements are met:
1.) Every config file should have at least the following sections: bumpversion, bumpversion_files_whitelisted, bumpversion_files_blacklisted, sync_files_blacklisted, sync_level
2.) bumpversion
should only contain a current_version
value (the project’s current version)
3.) bumpversion_files_whitelisted
should contain at least the .cookietemple.yml
file in the dot_cookietemple
variable
4.) sync_level
should only contain a ct_sync_level
value (and this value should be one of either patch
, minor
or major
)
5.) sync_files_blacklisted
should contain at least the CHANGELOG.rst
file (excluding it from syncing to avoid PR updates)
6.) sync
should only contain a sync_enabled
value (and this value should be one of either True|true|Yes|yes|Y|y|False|false|No|no|N|n
)
cli-python#
cli-python-1#
cli-python-2#
cli-python-3#
cookietemple.cfg
section called sync_files_blacklisted
misses either requirements = requirements.txt
, requirements_dev = requirements_dev.txt
or
changelog = CHANGELOG.rst
.
All are required to exclude them from syncing and interference with services like dependabot.cli-java#
cli-java-1#
cli-java-2#
cookietemple.cfg
section called sync_files_blacklisted
misses build_gradle = gradle.build
or
changelog = CHANGELOG.rst
.
Both are required to exclude the gradle build file from syncing.lib-cpp#
lib-cpp-1#
lib-cpp-2#
cookietemple.cfg
section called sync_files_blacklisted
misses changelog = CHANGELOG.rst
.
This is required to be excluded from syncing.web-python#
web-python-1#
web-python-2#
cookietemple.cfg
section called sync_files_blacklisted
misses either requirements = requirements.txt
, requirements_dev = requirements_dev.txt
or changelog = CHANGELOG.rst
.
All are required to exclude them from syncing and interference with services like dependabot.gui-java#
gui-java-1#
gui-java-2#
cookietemple.cfg
section called sync_files_blacklisted
misses pom = pom.xml
or changelog = CHANGELOG.rst
.
Both are required to be excluded from syncing.pub-thesis#
pub-thesis-1#
pub-thesis-2#
cookietemple.cfg
section called sync_files_blacklisted
misses changelog = CHANGELOG.rst
.
This is required to be excluded from syncing.