Skip to content

Add standalone mangle-lint CLI tool#88

Open
danielostrow wants to merge 1 commit intogoogle:mainfrom
danielostrow:feature/mangle-linter
Open

Add standalone mangle-lint CLI tool#88
danielostrow wants to merge 1 commit intogoogle:mainfrom
danielostrow:feature/mangle-linter

Conversation

@danielostrow
Copy link
Contributor

mangle-lint

  • Adds a new lint/ package and cmd/mangle-lint binary — a standalone linter for Mangle .mg files
  • Reuses the existing analysis infrastructure (validation, temporal recursion, stratification, bounds checking) and surfaces findings as lint results
  • Adds 6 new lint checks on top of existing analysis:
Rule Severity Description
unused-predicate Warning Declared predicates that are never referenced
missing-doc Info Predicates without documentation descriptors
naming-convention Warning Enforces snake_case predicates and uppercase variables
singleton-variable Warning Variables appearing only once in a clause (likely typos)
overly-complex-rule Info Rules exceeding a configurable premise threshold
dead-code Info IDB predicates whose results are never consumed
  • Supports text and JSON output formats
  • Rules are individually toggleable via -disable / -enable flags
  • Exit codes: 0 (clean/info), 1 (warnings), 2 (errors)

Usage

# Lint files
mangle-lint examples/*.mg

# JSON output, warnings only
mangle-lint -format json -severity warning examples/*.mg

# Disable specific rules
mangle-lint -disable missing-doc,dead-code examples/*.mg

# List all available rules
mangle-lint -list-rules

@google-cla
Copy link

google-cla bot commented Feb 18, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Introduces a new lint/ package and cmd/mangle-lint binary that reuses
the existing analysis infrastructure and adds new quality checks:
unused predicates, missing documentation, naming conventions, singleton
variables, rule complexity, and dead code detection. Supports text and
JSON output, configurable severity, and per-rule enable/disable flags.
@danielostrow
Copy link
Contributor Author

@burakemir can you please review this linter? I wanted to separate this as a separate cmd as opposed to debugging on compiler feedback alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments