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
Terminal output of the example, each violation with its line

Submodules#