com um clique
add-linter
// Guided workflow for adding a new linter to MegaLinter. Use when a contributor needs to add support for a new linting tool.
// Guided workflow for adding a new linter to MegaLinter. Use when a contributor needs to add support for a new linting tool.
Add a new MegaLinter flavor (language-specific Docker image). Use when creating a new specialized Docker image variant.
Add a new output reporter to MegaLinter. Use when adding support for a new CI system or output format.
Gather requirements for a MegaLinter change by asking clarifying questions until the problem is fully understood. First step of the contribution workflow.
Design a MegaLinter solution and write a technical specification. Second step of the contribution workflow, use after /analyze.
Diagnose MegaLinter .mega-linter.yml configuration issues. Use when linters aren't running as expected or configuration seems wrong.
End-to-end workflow to fix a GitHub issue — collect context, analyze, implement on a branch, open a PR, then hand off to /pr-watch-fix until CI is green.
| name | add-linter |
| description | Guided workflow for adding a new linter to MegaLinter. Use when a contributor needs to add support for a new linting tool. |
| allowed-tools | Read Grep Glob Bash Edit Write WebSearch WebFetch |
| argument-hint | ["linter-name"] |
| model | sonnet |
Guide me through adding the linter $ARGUMENTS to MegaLinter. If no linter name was provided, ask me for:
Search the internet to gather all available information about the linter:
is_formatter: true) or a linter.eslintignore)Check if a descriptor exists in megalinter/descriptors/ for this language. If not, create a new <lang>.megalinter-descriptor.yml.
Add the linter entry with as many properties as possible. Even though the JSON schema only requires linter_name, linter_url, and examples, aim for maximum completeness. Fill in ALL of these when applicable:
Identity (required):
linter_name — CLI executable name, lowercaselinter_url — tool websiteexamples — CLI usage (with and without config file)Documentation (strongly recommended):
linter_text — rich markdown description: features, what it checks, when to use itlinter_repo — GitHub repository URLlinter_rules_url — URL listing all ruleslinter_rules_configuration_url — how to configurelinter_rules_inline_disable_url — how to suppress rules inlinelinter_rules_ignore_config_url — how to ignore fileslinter_spdx_license — SPDX license IDlinter_speed — 1 (very slow) to 5 (very fast)linter_image_url, linter_icon_png_url, linter_banner_image_url — logos/bannersCLI configuration (always fill):
cli_lint_mode — file, list_of_files, or projectcli_executable — if different from linter_nameconfig_file_name — default config file (e.g., .pylintrc)cli_config_arg_name — config argument (e.g., --config)cli_lint_extra_args — default extra argumentscli_lint_fix_arg_name — fix argument (e.g., --fix)cli_lint_fix_remove_args — args to remove in fix modecli_version_arg_name — if not --versioncli_help_arg_name — if not --helpignore_file_name, cli_lint_ignore_arg_name — ignore file supportError parsing (important for accurate counts):
cli_lint_errors_count — regex_count, regex_number, regex_sum, total_lines, or sarifcli_lint_errors_regex — regex matching error lines in outputSARIF support (if available):
can_output_sarif: truecli_sarif_args — with {{SARIF_OUTPUT_FILE}} placeholderBehavior flags:
is_formatter: true — if it's a formatteractivation_rules — if it depends on env vars (e.g., style preference)active_only_if_file_found — only activate if certain config files existInstall (required):
install:
dockerfile:
- |-
# renovate: datasource=pypi depName=tool-name
ARG PIP_TOOL_VERSION=1.2.3
pip:
- tool-name==${PIP_TOOL_VERSION}
supported_platforms with install_override for ARM if neededIDE section (always fill):
ide.vscode, ide.idea, ide.eclipse, ide.sublime, ide.emacs, ide.atom, ide.visual_studio[{name: "Extension Name", url: "marketplace-url"}]Testing:
test_folder — if different from lowercase descriptor_idtest_variables — env vars for testsLook at existing well-populated descriptors like megalinter/descriptors/python.megalinter-descriptor.yml for reference.
Create two test files in .automation/test/<test_folder>/:
cli_lint_errors_regexCreate a minimal class in megalinter/linters/ extending megalinter.Linter. Only override what the YAML descriptor can't express.
Run make megalinter-build to auto-generate Dockerfiles, test classes, schemas.
Do NOT run make megalinter-build-with-doc — documentation is handled by auto-update workflows and generating it in PRs causes merge conflicts.
LINTER="<descriptor_id_lowercase>_<linter_name>"
docker buildx build --platform linux/amd64 --file linters/$LINTER/Dockerfile --tag $LINTER .
docker run --rm --env TEST_CASE_RUN=true --env OUTPUT_DETAIL=detailed \
--env TEST_KEYWORDS="${LINTER}_test" --env MEGALINTER_VOLUME_ROOT="." \
--volume "$(pwd):/tmp/lint" $LINTER
CHANGELOG.md (repo root, beta section):
- Add [linter-name](linter_url) linter for <language> — <what it detects, one sentence>
user/add-<linter-name>quick build + TEST_KEYWORDS=<linter>_test in commit message body during dev