360 Secure SkillHub
360 安全技能中心

Editorconfig Linter

提供本地命令行工具:validate 检查 .editorconfig 语法(属性名与取值、重复或不可达节、glob 模式等);check、show 按 9 项规则检查源代码文件的缩进、行尾、字符集、行宽等并支持 text/json/markdown 输出;fix 自动修复违规;--strict 可用于 CI 退出码判断。

charlie-morrison
charlie-morrison
热度 53.22
最近更新 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