

This is a tool to check if your files consider your .editorconfig rules.
Most tools—like linters, for example—only test one filetype and need an extra configuration.
This tool only needs your .editorconfig to check all files.
If you don't know about editorconfig already you can read about it here: editorconfig.org.
Currently, implemented editorconfig features are:
end_of_lineinsert_final_newlinetrim_trailing_whitespaceindent_styleindent_sizemax_line_lengthcharset (see Charset Setting below)Unsupported features are:
spelling_languagetab_widthVERSION="v3.8.0"
OS="linux"
ARCH="amd64"
curl -O -L -C - https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$VERSION/ec-$OS-$ARCH.tar.gz && \
tar xzf ec-$OS-$ARCH.tar.gz && \
./bin/ec-$OS-$ARCH
You can install editorconfig-checker in several ways, depending on your platform and preferences:
If you have Go installed, you can install editorconfig-checker with the following command:
go install github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@latest
Grab a binary from the release page.
If you use Nix:
nix-env -iA nixpkgs.editorconfig-checker
Or, with flakes:
nix run nixpkgs#editorconfig-checker
You can run editorconfig-checker inside a Docker container without installing it locally:
docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker
This command mounts your current directory into the container and runs the check inside it.
See also: Docker Hub: mstruebing/editorconfig-checker
If you use mise, install with:
mise use -g editorconfig-checker@latest
If you use Homebrew on macOS or Linux:
brew install editorconfig-checker
shell
pacman -S editorconfig-checkershell
# With your favorite AUR helper, e.g.:
paru -S editorconfig-checker-gitWe do have a couple of language specific wrappers available that you can install with your favorites language package manager. See their respective documentation for installation and usage instructions.
USAGE:
editorconfig-checker [OPTIONS] [FILE...]
With no FILE arguments, all files tracked by git are checked. When one or
more FILE arguments are given, only those files are checked (the configured
exclude patterns still apply).
OPTIONS:
-color
enables printing color
-config string
config
-cpuprofile string
write cpu profile to file
-debug
print debugging information
-disable-charset
disables only the charset check
-disable-end-of-line
disables the trailing whitespace check
-disable-indent-size
disables only the indent-size check
-disable-indentation
disables the indentation check
-disable-insert-final-newline
disables the final newline check
-disable-max-line-length
disables only the max-line-length check
-disable-trim-trailing-whitespace
disables the trailing whitespace check
-dry-run
show which files would be checked
-exclude string
a regex which files should be excluded from checking - needs to be a valid regular expression. Combine patterns with | (pipe): -exclude "vendor|testdata"
-f value
specify the output format: default, codeclimate, gcc, github-actions (default default)
-format value
specify the output format: default, codeclimate, gcc, github-actions (default default)
-h print the help
-help
print the help
-ignore-defaults
ignore default excludes
-init
creates an initial configuration
-no-color
disables printing color
-v print debugging information
-verbose
print debugging information
-version
print the version number
If you run this tool from a repository root it will check all files which are added to the git repository and are text files. If the tool isn't able to determine a file type it will be added to be checked too.
If you run this tool from a normal directory it will check all files which are text files. If the tool isn't able to determine a file type it will be added to be checked too.
The following output formats are supported:
text
<file>:
<startingLine>-<endLine>: <message>
- gcc: GCC compatible output. Useful for editors that support compiling and showing syntax errors.
<file>:<line>:<column>: <type>: <message>
- github-actions: The format used by GitHub Actions
::error file=<file>,line=<startingLine>,endLine=<endingLine>::<message>
- codeclimate: The Code Climate json format used for custom quality reports in GitLab CI
json
[
{
"check_name": "editorconfig-checker",
"description": "Wrong indent style found (tabs instead of spaces)",
"fingerprint": "e87a958a3960d60a11d4b49c563cccd2",
"severity": "minor",
"location": {
"path": ".vscode/extensions.json",
"lines": {
"begin": 2,
"end": 2
}
}
}
]
The configuration is done via arguments or it will take the first config file found with the following file names:
.editorconfig-checker.json.ecrc (deprecated filename, soon unsupported)A sample configuration file can look like this and will be used from your current working directory if not specified via the --config argument:
{
"$schema": "https://raw.githubusercontent.com/editorconfig-checker/editorconfig-checker/v3.8.0/.editorconfig-checker.schema.json",
"Verbose": false,
"Debug": false,
"IgnoreDefaults": false,
"SpacesAfterTabs": false,
"NoColor": false,
"Exclude": [],
"AllowedContentTypes": [],
"PassedFiles": [],
"Disable": {
"EndOfLine": false,
"Indentation": false,
"IndentSize": false,
"InsertFinalNewline": false,
"TrimTrailingWhitespace": false,
"MaxLineLength": false,
"Charset": false
}
}
The $schema property is an optional field for specifying the JSON Schema and is ignored by editorconfig-checker.
| Key | Type | Default | Description |
|---|---|---|---|
Verbose |
bool | false |
Print verbose output during checking |
Debug |
bool | false |
Print debugging information |
IgnoreDefaults |
bool | false |
Ignore the default exclude patterns |
SpacesAfterTabs |
bool | false |
Allow spaces after tabs in indentation (mixed indentation). When false, spaces following tabs are flagged as errors |
NoColor |
bool | false |
Disable colored output |
Exclude |
string[] | [] |
Regular expressions for files to exclude from checking |
AllowedContentTypes |
string[] | [] |
Additional content types to check (added to the defaults listed below) |
PassedFiles |
string[] | [] |
Explicit list of files, directories, or shell-style glob patterns (e.g. src/*.go) to check. When set, only these paths are checked instead of auto-discovering files from the working directory or git. Glob patterns that don't match any file are left as-is so a subsequent content-type check surfaces the missing path |
Version |
string | "" |
When set, the tool verifies this value matches the binary version and exits with an error if they differ. Useful for pinning a specific version in CI |
Disable |
object | Selectively disable individual checks (see below) |
You can set any of the options under the "Disable" section to true to disable those particular checks.
You could also specify command line arguments, and they will get merged with the configuration file. The command line arguments have a higher precedence than the configuration.
You can create a configuration with the init-flag. If you specify a config-path it will be created there.
By default, the allowed_content_types are:
text/ (matches text/plain, text/html, etc.)application/ecmascriptapplication/jsonapplication/x-ndjsonapplication/xml+json (matches application/geo+json, etc.)+xml (matches application/rss+xml, etc.)application/octet-streamapplication/octet-stream is needed as a fallback when no content type could be determined. You can add additional accepted content types with the allowed_content_types key. But the default ones don't get removed.
You can exclude single lines inline. To do that you need a comment on that line that says: editorconfig-checker-disable-line.
const myTemplateString = `
first line
wrongly indented line because it needs to be` // editorconfig-checker-disable-line
Alternatively, you can use editorconfig-checker-disable-next-line to skip the line that comes after this comment.
This modifier is present to improve readability, or because your sometimes have no other choice because of your own/language constraints.
// editorconfig-checker-disable-next-line used because blah blah blah what ever the reason blah
const myTemplateString = `a line that is (...) longer (...) than ... usual` // or with a very long inline comment
Please note that using editorconfig-checker-disable-next-line has only an effect on the next line, so it will report if the line where you added the modifier doesn't comply.
To temporarily disable all checks, add a comment containing editorconfig-checker-disable. Re-enable with a comment containing editorconfig-checker-enable
// editorconfig-checker-disable
const myTemplateString = `
first line
wrongly indented line because it needs to be
`
// editorconfig-checker-enable
You can exclude paths from being checked in several ways:
--excludeThe --exclude flag accepts a single regular expression. To exclude multiple patterns, combine them using | (regex alternation):
editorconfig-checker --exclude "vendor|testdata|\.min\.js$"
In a configuration file, you can list each pattern as a separate entry in the Exclude array instead:
{
"Exclude": ["vendor", "testdata", "\\.min\\.js$"]
}
All these excludes are used in addition to the default excludes, unless you [opt out of them](#ignor
—
$ claude mcp add editorconfig-checker \
-- python -m otcore.mcp_server <graph>