scitex_linter
SciTeX Linter — enforce reproducible research patterns via AST analysis.
- scitex_linter.list_rules(category=None)[source]
Return all rules (built-in + plugin), optionally filtered by category.
Submodules
scitex_linter.checker
AST-based checker that detects SciTeX anti-patterns.
- class scitex_linter.checker.Issue(rule, line, col, source_line='')[source]
Bases:
object- __init__(rule, line, col, source_line='')
- scitex_linter.checker.is_script(filepath, config=None)[source]
Check if file is a script (not a library module).
Uses config.library_patterns and config.library_dirs to determine which files are library modules (exempt from script-only rules).
- Return type:
scitex_linter.rules
Rule definitions for SciTeX linter.
Thin re-export module: actual definitions live in _rules/ sub-modules.
scitex_linter.formatter
Output formatting for terminal and JSON.
scitex_linter.runner
Run a Python script after linting it.
Core function used by the scitex-linter python subcommand.
scitex_linter.cli
CLI entry point for scitex-linter.
- Usage:
scitex-linter check <path> [–json] [–severity] [–category] [–no-color] scitex-linter format <path> [–check] [–diff] scitex-linter python <script.py> [–strict] [– script_args…] scitex-linter rule [–json] [–category] [–severity] scitex-linter list-python-apis [-v|-vv|-vvv] [–json] scitex-linter mcp start scitex-linter mcp list-tools [-v|-vv|-vvv] scitex-linter –help-recursive
- scitex_linter.cli._collect_files(path, recursive=True, config=None)[source]
Collect Python files from a path.
- Return type:
scitex_linter.config
Configuration system for scitex-linter.
- class scitex_linter.config.LinterConfig(severity='info', exclude_dirs=<factory>, library_patterns=<factory>, library_dirs=<factory>, script_dirs=<factory>, disable=<factory>, enable=<factory>, per_rule_severity=<factory>, required_injected=<factory>)[source]
Bases:
objectConfiguration for scitex-linter behavior.
- __init__(severity='info', exclude_dirs=<factory>, library_patterns=<factory>, library_dirs=<factory>, script_dirs=<factory>, disable=<factory>, enable=<factory>, per_rule_severity=<factory>, required_injected=<factory>)
- scitex_linter.config.load_config(start_path=None)[source]
Load configuration from defaults, pyproject.toml, and environment variables.
Priority: env vars > pyproject.toml > defaults
scitex_linter.flake8_plugin
Flake8 plugin for SciTeX linter.
- Usage:
pip install scitex-linter flake8 –select STX script.py
scitex_linter._fm_checker
FM (Figure/Millimeter) rule detection — opt-in category.
Detects inch-based matplotlib patterns and suggests mm-based alternatives. Used as a second-pass AST visitor from lint_source when “FM” is enabled.
- scitex_linter._fm_checker._is_exempt_call(node)[source]
Check if the call is on a stx.* or fr.* object (exempt from FM rules).
- scitex_linter._fm_checker._has_kwarg(node, name, value=None)[source]
Check if call has a specific keyword argument.
- class scitex_linter._fm_checker.FMChecker(source_lines, config)[source]
Bases:
NodeVisitorAST visitor for FM (Figure/Millimeter) rules.
- category = 'figure'
scitex_linter._packages
Detect available packages for conditional rule gating.