用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/oxsecurity/megalinter --skill fix-linter-test命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | fix-linter-test |
| description | Debug and fix a failing MegaLinter linter test. Use when a linter test fails in CI or locally. |
| allowed-tools | Read Grep Glob Bash Edit |
| argument-hint | [linter-name-or-test-output] |
| model | sonnet |
| metadata | {"internal":true} |
Debug the failing test for $ARGUMENTS.
Steps:
megalinter/tests/test_megalinter/linters/@generated by .automation/build.py header) — if so, fix the descriptor YAML or fixtures, NOT the test file itselfmegalinter/descriptors/ to understand expected behavior (cli_lint_mode, supported_cli_lint_modes, config_file_name, cli_lint_errors_regex, file_extensions).automation/test/<test_folder>/:
cli_lint_errors_regexfile_extensions or file_names_regex in the descriptormegalinter/linters/, review it for issuesfile_extensionscli_lint_errors_regex doesn't match actual linter output formatconfig_file_namecli_lint_mode mismatch (file vs list_of_files vs project)supported_cli_lint_modes lists a mode the tool can't run — the per-mode tests (test_success_<mode>_lint_mode / test_failure_<mode>_lint_mode) run for every declared mode; if a failure is confined to one mode, remove it from supported_cli_lint_modes (unsupported modes are auto-skipped)test_success_project_lint_mode fails on a file under .wireit/: that is a poison fixture guarding excluded-directories forwarding (see .claude/rules/testing.md). The forwarding is broken, not the fixture — check the command in the log for the forwarded exclusion arguments and the [Excluded directories] trace line, then review the descriptor's cli_lint_mode_project_exclude_* properties or the class manage_excluded_directories_config() / build_lint_command override (a custom build_lint_command that does not call super() bypasses forwarding). Do NOT delete the poison fixture to make the test passLINTER="<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
To run only specific test methods, use a -k-style substring (matches all modes):
# all failure-mode tests (test_failure_file_lint_mode, _list_of_files_, _project_)
--env TEST_KEYWORDS="${LINTER}_test and test_failure"
# narrow to a single mode
--env TEST_KEYWORDS="${LINTER}_test and test_failure_project_lint_mode"
TEST_KEYWORDS=<linter>_testCHANGELOG.md only if the fix changes user-visible linter behavior (wrong error count, missed files, broken output). Add one line under Fixes in the beta section:
- Fix <linter-name>: <what was wrong and what users now get>
Do NOT add an entry for test-infrastructure-only fixes (fixture paths, test class regeneration, etc.). Style: .claude/rules/changelog.md (written for end users, no internal details).Guided workflow for adding a new linter to MegaLinter. Use when a contributor needs to add support for a new linting tool.
Fix the errors reported by MegaLinter. Use after megalinter-check found errors, or when the user pastes MegaLinter/CI lint errors and wants them fixed. Applies safe fixes automatically (auto-fix linters first, then guided manual fixes using per-linter fix guides), asks the user when fixing is ambiguous, and can disable rules or linters with user confirmation. Never pushes to the default branch.
Collect MegaLinter lint errors for the current repository. Use when the user wants to know if the code passes linting, why the MegaLinter CI job fails, or before/after fixing lint errors. Two modes - watch a CI job (GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines) and parse its logs, or run MegaLinter locally with Docker (full run or fast parallel standalone linter runs).
基于 SOC 职业分类