Skip to main content

CQ

Code quality checker package

Usage

Checking

Just run cq in the root of your package.

$ cq
requirements_setup_compatibility
setup.py: setup.py: does not contain requirement 'coverage' that is in requirements.txt
dumb_style_checker
setup.py:20: Put exactly one space before and after `=`  [...     name='.........', ...].
package/api.py:191: Put exactly one space before and after `=`  [... def fake_localtime(t=None): ...].
pyflakes-ext
Hint: use `# NOQA` comment for disabling pyflakes on particular line
./tests/test_warnings.py:4: 'types' imported but unused
mypy
Hint: use `# type: ignore` for disabling mypy on particular line
package/api.py:42: error: Need type annotation for 'freeze_factories' (hint: "freeze_factories: List[<type>] = ...")
pylint
Hint: use `# pylint: disable=<violation name>` for disabling line check. For a list of violations, see `pylint --list-msgs`
package/api.py:56: [W0212(protected-access), ] Access to a protected member _uuid_generate_time of a client class

You can specify path to packages that you want to test, if you want to test whole library/app.

$ cq package_1 package_2

Checkers are run in threads. Some of them (e.g. pylint, mypy) spawn an external process so this checkers run in parallel.

To disable certain checker for the whole run add option -d:

$ cq -d pylint -d branch_name_check

Warnings are hidden by default. To display them, run cq with --show-warnings

$ cq --show-warnings

If something takes too long use debug output, which will print timing for each checker:

$ cq --debug

Most of the checkers support disabling the error in the comment on the respective line. For example in pylint you can use

# pylint: disable = protected-access

to disable protected access check in the current context.

Fixing

Just run cq --fix with the same options as regular cq.

Checkers

  • pylint - comprehensive linter
  • mypy - checks python typing
  • pyflakes-ext - another general linter
  • grammar_nazi - grammar/spelling errors
  • dumb_style_checker - basic python mistakes (e.g. use of print in a library)
  • setup_check - setup.py validator
  • branch_name_check - check whether current branch name comply with Quantlane standards
  • orange - code formatter based on black
  • isort - isort your imports, so you don't have to
  • safety - checks installed dependencies for known security vulnerabilities

Fixers

  • orange - code formatter based on black
  • isort - isort your imports, so you don't have to

pylint

You can override the packaged pylint rules in .pylintrc in the root of your project (actually in $PWD/.pylintrc for cq run)

Pylint checker can output two types of issues: warning and error. Errors are in bold typeset. Warnings can (but should not) be ignored.

mypy

Config can be overridden by having mypy.ini in the root of your project

Metadata

Release files for ql-cq 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ql-cq 1.9.0
File Size Uploaded
ql_cq-1.9.0.tar.gz 26.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ql-cq 1.9.0
File Interpreter ABI Platform
ql_cq-1.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 63.7 kB

Release files / ql_cq-1.9.0.tar.gz

Download URL ql_cq-1.9.0.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
67752770817081953c347d3b09944692aa0ab88a29679fa005d56f04912dad82
BLAKE2b-256 checksum
How to use checksums
41cf298d891af3077870e6bb3965aa0fb672b37183cd4eb55396eb2b7254c2ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

Release files / ql_cq-1.9.0-py3-none-any.whl

Download URL ql_cq-1.9.0-py3-none-any.whl
Size 37.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8de0323763869cf80ac81466d9a14c9d138a56ad759a9170d362accbf4cc8e10
BLAKE2b-256 checksum
How to use checksums
42badaf9f7084d3e52a3903b75b03248499e5f94213b56a5fddc6195e20d9013
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.9.0 This release

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

1 release file

1.4.1

3 release files

1.4.0

1 release file

1.3.2

2 release files

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

2 release files

0.43.0

2 release files

0.42.0

2 release files

0.41.0

1 release file

0.40.0

1 release file

0.39.0

1 release file

0.38.1

1 release file

0.38.0

1 release file

0.37.0

1 release file

0.36.0

1 release file

0.35.0

2 release files

0.34.1

2 release files

0.34.0

1 release file

0.33.6

1 release file

0.33.5

1 release file

0.33.4

1 release file

0.33.3

1 release file

0.33.2

1 release file

0.33.1

1 release file

0.33.0

1 release file

0.32.1

1 release file

0.32.0

1 release file

0.31.0

1 release file

0.30.0

1 release file

0.29.1

1 release file

0.28.0

1 release file

0.27.0

1 release file

0.26.0

1 release file

0.25.2

1 release file

0.25.1

1 release file

0.25.0

1 release file

0.24.0

1 release file

0.23.2

1 release file

0.23.1

1 release file

0.23.0

1 release file

0.22.5

1 release file

0.22.4

1 release file

0.22.3

1 release file

0.22.2

1 release file

0.22.1

1 release file

0.22.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page