360 Secure SkillHub
360 安全技能中心

Editorconfig Linter

核心功能:验证.editorconfig文件语法(如无效属性、重复段等),检查源码是否符合缩进、换行等9项配置规则,显示文件生效配置,自动修复违规。典型场景:本地开发配置校验、CI流程代码合规检查。通过命令行调用,支持文本/JSON/Markdown输出,含严格模式适配CI,可自定义排除文件等参数。

charlie-morrison
charlie-morrison
热度 53.17
最近更新 2026-05-11 17:42:36
分类:开发依赖:代码执行 / 读写文件应用场景:代码审查 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add editorconfig-linter
Metadata
name
editorconfig-linter
description
Validate .editorconfig syntax and check source files for EditorConfig compliance.
version
1.0.0

EditorConfig Linter

Validate .editorconfig files and check source files for compliance.

Commands

Validate .editorconfig syntax

python3 scripts/editorconfig-linter.py validate .editorconfig

Check files against .editorconfig rules

python3 scripts/editorconfig-linter.py check src/
python3 scripts/editorconfig-linter.py check src/ --editorconfig .editorconfig

Show effective config for a file

python3 scripts/editorconfig-linter.py show src/main.py

Fix violations automatically

python3 scripts/editorconfig-linter.py fix src/

Options

  • --editorconfig PATH — Path to .editorconfig (default: auto-discover)
  • --format text|json|markdown — Output format (default: text)
  • --strict — Exit 1 on any violation (CI mode)
  • --exclude PATTERN — Glob pattern to exclude (repeatable)
  • --max-files N — Max files to check (default: 1000)

What It Checks

.editorconfig Syntax

  • Invalid property names
  • Invalid property values (indent_style must be tab/space, etc.)
  • Duplicate sections
  • Unreachable sections (shadowed by earlier glob)
  • Missing root = true
  • Invalid glob patterns

File Compliance (9 rules)

  • indent_style — tabs vs spaces
  • indent_size — number of spaces per indent
  • end_of_line — lf, crlf, cr
  • charset — utf-8, utf-8-bom, latin1, utf-16be, utf-16le
  • trim_trailing_whitespace — trailing whitespace check
  • insert_final_newline — file ends with newline
  • max_line_length — line length limit
  • tab_width — tab display width
  • Mixed indentation detection

Exit Codes

  • 0: No violations
  • 1: Violations found (or --strict)
  • 2: Invalid arguments or .editorconfig errors