scripts/refactor/lint_report_pkg
¶
scripts.refactor.lint_report_pkg.__init__
¶
๐ง Docstring Summary
Section | Content |
---|---|
Description | Plugin-based quality-checker package. |
core.merge_into_refactor_guard() is the only public entry-point most |
|
code ever needs. | |
Args | โ |
Returns | โ |
๐ ๏ธ Functions¶
register
¶
Decorator used by each plugin module to register it in the plugin registry. Parameters: ['name: str'] Returns: Callable[[Type], Type]
_inner
¶
No description available. Parameters: ['cls: Type'] Returns: Type
_discover_plugins
¶
Discovers and imports all plugin modules in the 'plugins' directory. This function automatically imports all Python files in the 'plugins' directory, excluding those that start with an underscore. Returns: None
scripts.refactor.lint_report_pkg.core
¶
๐ง Docstring Summary
Section | Content |
---|---|
Description | Core Module for Lint Report Package |
===================================== | |
This module provides the base class for tool plugins and functions for plugin discovery. | |
It includes the abstract base class ToolPlugin that all plugins must implement, | |
and a utility to access all discovered plugins. | |
Args | โ |
Returns | โ |
๐ฆ Classes¶
ToolPlugin
¶
Abstract base class for tool plugins. All subclasses must define: - name: str (unique plugin name) - default_report: Path (where output is written) - run(): run the tool - parse(dst): enrich the lint result dictionary Returns: None
๐ ๏ธ Functions¶
name
¶
Unique plugin identifier (e.g., 'flake8'). Parameters: ['self: Any'] Returns: str
default_report
¶
Path where the tool writes its report (txt/json/xml). Parameters: ['self: Any'] Returns: Path
run
¶
Execute the tool, writing to default_report
; return exit code.
Parameters:
['self: Any']
Returns:
int
parse
¶
Read default_report
and update dst
with findings.
Parameters:
['self: Any', 'dst: Dict[str, Dict[str, Any]]']
Returns:
None
all_plugins
¶
Return all ToolPlugin instances registered by plugin modules. Returns: List[ToolPlugin]
scripts.refactor.lint_report_pkg.helpers
¶
๐ง Docstring Summary
Section | Content |
---|---|
Description | Helpers for Lint Report Package |
=============================== | |
This module provides utility functions shared by the quality-checker core and plugins. | |
It includes functions for running commands, printing safely, and reading report files. | |
Args | โ |
Returns | โ |
๐ ๏ธ Functions¶
safe_print
¶
Print msg
even on exotic console encodings (swallows UnicodeEncodeError).
Parameters:
['msg: str']
Returns:
None
run_cmd
¶
Run cmd, write combined stdout + stderr to output_file (UTF-8), and return the subprocess' exit-code. Parameters: ['cmd: Sequence[str]', 'output_file: Union[str, os.PathLike]'] Returns: int
read_report
¶
Return the textual contents of path (empty string if the file is missing), decoding as UTF-8 and falling back to โreplaceโ for any bad bytes. Parameters: ['path: Path'] Returns: str
scripts.refactor.lint_report_pkg.lint_report_cli
¶
๐ง Docstring Summary
Section | Content |
---|---|
Description | Lint Report CLI |
=============================== | |
This script enriches a RefactorGuard audit file with linting, coverage, and docstring analysis data. | |
Key points: | |
- Zero-setup: If the audit JSON is missing, an empty one is created for plugins to populate. | |
- No --reports argument: Each plugin runs its own tool and saves its report next to the audit file. | |
- Optional docstring merge: If a docstring summary JSON is present, it is injected under a top-level "docstrings" key in the audit file. | |
Typical usage: | |
$ python lint_report_cli.py --audit refactor_audit.json | |
$ python lint_report_cli.py --audit refactor_audit.json --docstrings docstring_summary.json | |
Args | โ |
Returns | โ |
๐ ๏ธ Functions¶
enrich_refactor_audit
¶
Enrich audit_path with lint, coverage, and optional docstring data. Parameters:
audit_path: str Path to the RefactorGuard audit JSON file. Parameters: ['audit_path: str'] Returns: None
scripts.refactor.lint_report_pkg.path_utils
¶
๐ง Docstring Summary
Section | Content |
---|---|
Description | Path Utilities for Quality Audit Modules |
=============================== | |
This module provides common path helper functions used across quality and audit modules. | |
It includes functions for normalizing paths relative to the repository root. | |
Args | โ |
Returns | โ |
๐ ๏ธ Functions¶
norm
¶
Return a repository-relative normalized path. If the file lives outside the repo, fall back to โlast-two componentsโ to avoid collisions yet stay platform-agnostic. Parameters: ['p: str | os.PathLike'] Returns: str
scripts.refactor.lint_report_pkg.quality_checker
¶
๐ง Docstring Summary
Section | Content |
---|---|
Description | Quality Checker for Lint Report Package |
======================================= | |
This module serves as the public API for the lint report package. | |
It imports all plugins, drives tool execution and parsing, and merges results into the RefactorGuard audit. | |
Args | โ |
Returns | โ |
๐ ๏ธ Functions¶
merge_into_refactor_guard
¶
Enrich audit_path with quality data produced by every plugin. Parameters
audit_path : str Path to the RefactorGuard audit JSON file. Parameters: ['audit_path: str'] Returns: None
merge_reports
¶
Return merged dict where b overrides a on duplicate keys. Parameters
file_a : str Path to the first JSON file. file_b : str Path to the second JSON file. Parameters: ['file_a: str', 'file_b: str'] Returns: Dict[str, Any]
scripts.refactor.lint_report_pkg.quality_registry
¶
๐ง Docstring Summary
Section | Content |
---|---|
Description | Quality Registry for Lint Report Package |
=============================== | |
This module provides functionality to register and run quality plugins. | |
It includes decorators for registering plugins and a method to invoke all registered plugins. | |
Args | โ |
Returns | โ |
๐ ๏ธ Functions¶
register
¶
Decorator to register a quality plug-in. Parameters: ['func: Plugin'] Returns: Plugin
run_all
¶
Invoke every registered plug-in in order. Parameters: ['quality: Dict[str, Dict[str, Any]]', 'report_paths: Dict[str, Path]'] Returns: None