stouputils.check package#
Style rules that ruff cannot express, checked on text files and Python sources.
Each rule of RULES can be left out with ignore, and the limits tuned, in pyproject.toml:
[tool.stouputils.check]
ignore = ["tab-indentation", "space-alignment"]
final-newlines = { ".py" = 1, ".json" = 1 }
initial-newlines = { ".md" = 1, ".mcfunction" = 1 }
docstring-max-lines = 20
per-file-ignores = { "tests/**" = ["long-comment"] }
In a Python file, # stp: ignore[rule] silences its own line, or the multi-line string it closes,
and # stouputils: ignore[rule] the whole file.
# Write a Python file with a few style problems
cat > area.py <<'EOF'
PI = 3.14159 # Rounded to 5 decimals
def area(radius: float) -> float:
''' Area of a disk, radius in metres. '''
# Area of a disk,
# in square metres,
# rounded to 2 places
return round(PI * radius ** 2, 2)
EOF
# List what the style rules find in it
stouputils check area.py
Submodules#
- stouputils.check.cli module
- stouputils.check.python module
CLAUSE_ENDINGSCLAUSE_BOUNDARYNEW_ITEMEXAMPLES_HEADERTYPED_ARGUMENTSPAN_DELIMITERSSTRANDED_FRAGMENTSUPPRESSIONCONTROL_FLOWLAYOUT_TOKENSpython_errors()suppressions()suppression_from_comment()statements()indentation_errors()tab_aligned_lines()string_content_lines()comment_errors()docstring_layout_errors()directive_lines()constant_errors()paragraph_errors()statement_blocks()bound_names()paragraphs()is_docstring()docstring_errors()split_spans()code_block_indent()strands_fragment()
- stouputils.check.rules module
RULESViolationSuppressionCheckConfigCheckConfig.ignoreCheckConfig.per_file_ignoresCheckConfig.rootCheckConfig.final_newlinesCheckConfig.initial_newlinesCheckConfig.docstring_max_linesCheckConfig.comment_max_linesCheckConfig.fragment_max_wordsCheckConfig.paragraph_max_linesCheckConfig.paragraph_max_branchesCheckConfig.paragraph_max_bindingsCheckConfig.ignored_rules()CheckConfig.for_directory()