Showing 23 of 23 total issues
Function _do_test
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _do_test(self, *, test_obj: any, canon_obj: any,
Function test
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def test(self, obj: any, context: TestootContext,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, *, storage: Optional[TestootStorage] = None,
Function clone
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def clone(self, *, storage: Optional[TestootStorage] = None,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, *, test_obj: any, canon_obj: any, exc: Exception,
Function test_filename
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_filename(self, filename: str, *, context: TestootContext,
Function _do_test
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _do_test(self, *, test_obj: any, canon_obj: any,
storage_name: str, context: TestootContext,
comparator: Optional[Comparator] = None,
serializer: Optional[TestootSerializer] = None):
comparator = self._get_comparator(comparator, context=context)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Code block style Open
venv/bin/pytest -s tests
- Exclude checks
Module level import not at top of file Open
import testoot
- Read upRead up
- Exclude checks
Place imports at the top of the file.
Always put imports at the top of the file, just after any module
comments and docstrings, and before module globals and constants.
Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x
Okay: if x:\n import os
Line length Open
One pytest function is the scope of the result. Newly calculated data compares with the original canonized result.
- Read upRead up
- Exclude checks
MD013 - Line length
Tags: line_length
Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)
This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.
This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.
You also have the option to exclude this rule for code blocks and tables. To
do this, set the code_blocks
and/or tables
parameters to false.
Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.
Code block style Open
pip3 install testoot
- Exclude checks
Code block style Open
python3 -m venv venv
- Exclude checks
Code block style Open
cp TEST.sh.example TEST.sh
- Exclude checks
Line length Open
Testoot is "test out" of code for Python 3.4+. It's useful in unit and module testing when creating or rewriting test data is too boring. After you canonized the ideal output result all tests will pass until the data changes moment.
- Read upRead up
- Exclude checks
MD013 - Line length
Tags: line_length
Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)
This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.
This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.
You also have the option to exclude this rule for code blocks and tables. To
do this, set the code_blocks
and/or tables
parameters to false.
Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.
Bare URL used Open
https://testoot.readthedocs.io/
- Read upRead up
- Exclude checks
MD034 - Bare URL used
Tags: links, url
Aliases: no-bare-urls
This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:
For more information, see http://www.example.com/.
To fix this, add angle brackets around the URL:
For more information, see <http:></http:>.
Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.
Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:
`http://www.example.com`
Code block style Open
cd docs
- Exclude checks
Code block style Open
venv/bin/pytest -s tests --canonize
- Exclude checks
TODO found Open
# TODO: refactor this strange logic
- Exclude checks
The input method in Python 2 will read from standard input, evaluate and run the resulting string as python source code. This is similar, though in many ways worse, then using eval. On Python 2, use raw_input instead, input is safe in Python 3. Open
return input("Canonize [yn]? ") # pragma: no cover
- Exclude checks
FIXME found Open
# FIXME: this internal
- Exclude checks