pawnlint

module
v1.7.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT

README

pawnlint

Static analysis and linting for Pawn v3 (SA-MP and open.mp).

pawnlint parses with pawn-parser. The Pawn compiler is still the source of truth for compilation. Editor integrations can pass existing pawn-analysis results so equivalent semantic checks are not repeated.

Features

  • Syntax, semantic, control-flow, and include-graph analysis
  • 115 built-in rules across analysis, performance, API, and policy categories
  • Automatic fixes, inline suppressions, baselines, and incremental caching
  • Text, JSON, JSONL, SARIF, and GitHub Actions output
  • Stdin support for tool and CI integration

Install

go install github.com/pawnkit/pawnlint/cmd/pawnlint@latest

Usage

pawnlint gamemodes/main.pwn
pawnlint gamemodes/
pawnlint --format json gamemodes/
pawnlint --diff gamemodes/
pawnlint --fix gamemodes/
cat main.pwn | pawnlint --stdin --stdin-filename main.pwn

The default profile is recommended. Use --profile strict for more checks. From a project directory, pawnlint uses the manifest entry and include paths when no file arguments are given.

Command Purpose
pawnlint --list-rules List every rule
pawnlint --explain rule-id Explain a rule
pawnlint --init-config Write a default pawnlint.toml
pawnlint --check-config Validate config paths, entries, and includes
pawnlint --enable id --disable id paths... Toggle specific rules
pawnlint --format text|compact|json|jsonl|sarif|github paths... Choose an output format
pawnlint --diff paths... Preview available fixes
pawnlint --fix-safe paths... Apply machine-safe fixes
pawnlint --generate-baseline paths... Replace the configured baseline
pawnlint --prune-baseline paths... Remove resolved baseline entries
pawnlint --timings paths... Print stage and rule timings

Exit codes

Code Meaning
0 No finding reached the failure threshold.
1 A finding reached the failure threshold, or --diff found changes.
2 Invalid arguments or configuration.
3 Project analysis failed.

Errors fail by default. Warnings fail too when warnings-as-errors = true.

Documentation

Contributing

New rules, false-positive fixes, and small Pawn examples are welcome. See CONTRIBUTING.md for tests and ownership boundaries.

Directories

Path Synopsis
cmd
genapimetadata command
genruledocs command
pawnlint command
realworldstats command
internal
api
cli
Package cli implements the pawnlint command.
Package cli implements the pawnlint command.
fix
source/walk
Package walk provides CST traversal and indexed node lookup.
Package walk provides CST traversal and indexed node lookup.
pkg
editor
Package editor lints open buffers for editor integrations.
Package editor lints open buffers for editor integrations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL