Implementation:MaterializeInc Materialize Lint Manager
| Knowledge Sources | |
|---|---|
| Domains | CI/CD, Code Quality, Linting |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
The Lint Manager orchestrates execution of lint check scripts in a three-phase pipeline (before, main, after) with duration tracking, verbose output, and Buildkite integration.
Description
This module provides the lint CLI and LintManager class that discovers and executes lint check scripts from the ci/test/lint-main/ directory structure. Checks are organized into three sequential phases: before/ (pre-checks), checks/ (main lint checks), and after/ (post-checks). Each phase only runs if all previous phases passed. The manager runs individual check scripts as subprocesses, captures their exit codes, measures execution duration, and formats results with color-coded pass/fail indicators using terminal formatting utilities. It integrates with Buildkite for CI-specific output prefixes.
Usage
Use this module to run the full lint suite locally or in CI. It provides --verbose for detailed output, --print-duration for timing information, and --offline for checks that do not require network access.
Code Reference
Source Location
- Repository: MaterializeInc_Materialize
- File: misc/python/materialize/lint/lint.py
Signature
MAIN_PATH = MZ_ROOT / "ci" / "test" / "lint-main"
MAIN_CHECKS_PATH = MAIN_PATH / "checks"
CHECK_BEFORE_PATH = MAIN_PATH / "before"
CHECK_AFTER_PATH = MAIN_PATH / "after"
def parse_args() -> argparse.Namespace: ...
def main() -> int: ...
class LintManager:
def __init__(self, print_duration: bool, verbose_output: bool, offline: bool): ...
def run(self) -> int: ...
def run_and_validate_if_no_previous_failures(
self, path: Path, previous_failures: list
) -> list: ...
Import
from materialize.lint.lint import main, LintManager
I/O Contract
| Input | Type | Description |
|---|---|---|
| --print-duration | bool |
Show execution time per check (default: True) |
| --verbose | bool |
Show full subprocess output |
| --offline | bool |
Run only offline-capable checks |
| Output | Type | Description |
|---|---|---|
| return code | int |
0 if all checks pass, non-zero on failure |
| report | stdout | Color-coded check results with pass/fail indicators and optional durations |
Usage Examples
# Run all lint checks
bin/lint
# Run with verbose output and duration
bin/lint --verbose --print-duration
# Run offline checks only
bin/lint --offline