Skip to content
A tool to verify that your files are in harmony with your .editorconfig
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/editorconfig-checker
docs
pkg
testfiles
.editorconfig
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
Makefile
README.md

README.md

editorconfig-checker

Build Status codecov Go Report Card

Logo

  1. What
  2. Installation
  3. Usage
  4. 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
  5. Support

What?

Example Screenshot

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_line
  • insert_final_newline
  • trim_trailing_whitespace
  • indent_style
  • indent_size

Unsupported features are:

  • charset

Installation

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

USAGE:
  -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
  -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.

Excluding

Excluding lines

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-line

Excluding files

Inline

If 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 report

Default excludes

If 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$",
"\\.jepg$",
"\\.mp4$",
"\\.wmv$",
"\\.svg$",
"\\.ico$",
"\\.bak$",
"\\.bin$",
"\\.pdf$",
"\\.zip$",
"\\.gz$",
"\\.tar$",
"\\.7z$",
"\\.bz2$",
"\\.log$",
"\\.css\\.map$",
"\\.js\\.map$",
"min\\.css$",
"min\\.js$"

Manually excluding

via ecrc

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$
via arguments

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

Generally

Every exclude option is merged together.

Support

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.

You can’t perform that action at this time.