- What
 - Installation
 - Usage
 - Excluding
4.1 Excluding Lines
4.2 Excluding Files
4.2.1 Inline
4.2.2. Default Excludes
4.2.3. Manually Excluding
4.2.4. via ecrc
4.2.5. via arguments
4.2.6. Generally - Docker
 - Support
 
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_size
Unsupported features are:
charset
Grab a binary from the release page.
If you have go installed you can run go get github.com/editorconfig-checker/editorconfig-checker and run make build inside the project folder.
This will place a binary called ec into the bin directory.
USAGE:
  -disable-final-newline
        disables the final newline check
  -disable-indentation
        disables the indentation check
  -disable-line-ending
        disables the trailing whitespace check
  -disable-trailing-whitespace
        disables the trailing whitespace check
  -dry-run
        show which files would be checked
  -e string
        a regex which files should be excluded from checking - needs to be a valid regular expression
  -exclude string
        a regex which files should be excluded from checking - needs to be a valid regular expression
  -h    print the help
  -help
        print the help
  -i    ignore default excludes
  -ignore
        ignore default excludes
  -spaces-after-tabs
        allow spaces to be used as alignment after tabs
  -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.
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 indended line because it needs to be` // editorconfig-checker-disable-lineIf you want to exclude a file inline you need a comment on the first line of the file that contains: editorconfig-checker-disable-file
-- editorconfig-checker-disable-file
add :: Int -> Int -> Int
add x y =
  let result = x + y -- falsy indentation would not report
  in result -- falsy indentation would not reportIf you don't pass the i or ignore flag to the binary these files are excluded automatically:
"yarn\\.lock$",
"package-lock\\.json",
"composer\\.lock$",
"\\.snap$",
"\\.otf$",
"\\.woff$",
"\\.woff2$",
"\\.eot$",
"\\.ttf$",
"\\.gif$",
"\\.png$",
"\\.jpg$",
"\\.jpeg$",
"\\.mp4$",
"\\.wmv$",
"\\.svg$",
"\\.ico$",
"\\.bak$",
"\\.bin$",
"\\.pdf$",
"\\.zip$",
"\\.gz$",
"\\.tar$",
"\\.7z$",
"\\.bz2$",
"\\.log$",
"\\.css\\.map$",
"\\.js\\.map$",
"min\\.css$",
"min\\.js$"
You can create a file called .ecrc where you can put a regular expression on each line which files should be excluded. If you do this it will be merged with the default excludes.
Remember to escape your regular expressions correctly. :)
An .ecrc can look like this:
LICENSE$
slick-styles\.vanilla-css$
banner\.js$
react_crop\.vanilla-css$
vanilla
Resources/Public/Plugins
README\.md$
If you want to play around how the tool would behave you can also pass the --exclude|-e argument to the binary. This will accept a regular expression as well. If you use this argument the default excludes as well as the excludes from the .ecrc-file will merged together.
For example: ec --exclude node_modules
Every exclude option is merged together.
If you want to see which files the tool would check without checking them you can pass the --dry-run or -d flag.
You are able to run this tool inside a Docker container.
To do this you need to have Docker installed and run this command in your repository root which you want to check:
docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker
Dockerhub: mstruebing/editorconfig-checker
If you have any questions, suggestions, need a wrapper for a programming language or just want to chat join #editorconfig-checker on freenode(IRC). If you don't have an IRC-client set up you can use the freenode webchat.