All Projects β†’ editorconfig-checker β†’ Editorconfig Checker

editorconfig-checker / Editorconfig Checker

Licence: mit
A tool to verify that your files are in harmony with your .editorconfig

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Editorconfig Checker

flake8-broken-line
🚨 Flake8 plugin to forbid backslashes (\) for line breaks
Stars: ✭ 85 (-28.57%)
Mutual labels:  lint, linting, linter, code-quality
codeclimate-eslint
Code Climate Engine for ESLint
Stars: ✭ 86 (-27.73%)
Mutual labels:  linting, linter, code-quality
dockerfile-utils
A library and command line interface for formatting and linting Dockerfiles.
Stars: ✭ 17 (-85.71%)
Mutual labels:  lint, linting, linter
ue5-style-guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,892 (+2330.25%)
Mutual labels:  lint, linting, linter
li18nt
🌎 Lint your i18n translation files. Detect conflicting properties, duplicates and make it more readable and easier to maintain by formatting it!
Stars: ✭ 29 (-75.63%)
Mutual labels:  lint, linting, linter
eslint-plugin-import
ESLint plugin with rules that help validate proper imports.
Stars: ✭ 4,290 (+3505.04%)
Mutual labels:  lint, linting, code-quality
pahout
A pair programming partner for writing better PHP. Pahout means PHP mahout 🐘
Stars: ✭ 43 (-63.87%)
Mutual labels:  lint, clean-code, linter
Flakehell
Flake8 wrapper to make it nice, legacy-friendly, configurable.
Stars: ✭ 217 (+82.35%)
Mutual labels:  linter, linting, code-quality
Reviewdog
🐢 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+3715.97%)
Mutual labels:  linter, lint, code-quality
Wemake Python Styleguide
The strictest and most opinionated python linter ever!
Stars: ✭ 1,714 (+1340.34%)
Mutual labels:  linter, hacktoberfest, code-quality
Eslint Plugin Import
ESLint plugin with rules that help validate proper imports.
Stars: ✭ 3,722 (+3027.73%)
Mutual labels:  lint, linting, code-quality
therapist
Work out your commitment issues.
Stars: ✭ 29 (-75.63%)
Mutual labels:  lint, linting, linter
Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐢 It brings the dev-dependency concept to the .NET world!
Stars: ✭ 394 (+231.09%)
Mutual labels:  lint, linting, linter
makefiles
No description or website provided.
Stars: ✭ 23 (-80.67%)
Mutual labels:  lint, linting, linter
elm-lint
elm-lint lints Elm source code, to add additional guarantees to your project.
Stars: ✭ 27 (-77.31%)
Mutual labels:  lint, linting, linter
Gitlint
Linting for your git commit messages
Stars: ✭ 404 (+239.5%)
Mutual labels:  linter, lint, linting
Ue4 Style Guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,656 (+2131.93%)
Mutual labels:  linter, lint, linting
Dotenv Linter
☺️ Linting dotenv files like a charm!
Stars: ✭ 207 (+73.95%)
Mutual labels:  linter, linting, code-quality
JSONCustomLintr
Library to allow creation, running, and reporting of custom lint rules for JSON files
Stars: ✭ 19 (-84.03%)
Mutual labels:  lint, linting, linter
Detekt
Static code analysis for Kotlin
Stars: ✭ 4,169 (+3403.36%)
Mutual labels:  linter, lint, code-quality

editorconfig-checker

Buy Me A Coffee

Build Status codecov Hits-of-Code Go Report Card

Logo

  1. What
  2. Quickstart
  3. Installation
  4. Usage
  5. Configuration
  6. Excluding
    6.1 Excluding Lines
    6.2 Excluding Files
    6.2.1 Inline
    6.2.2 Default Excludes
    6.2.3 Manually Excluding
    6.2.4 via configuration
    6.2.5 via arguments
    6.2.6 Generally
  7. Docker
  8. Continuous Integration
  9. 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
  • max_line_length

Unsupported features are:

  • charset

Quickstart

VERSION="2.3.4"
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

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.

If you are using Arch Linux you can use:

<favourite-aur-helper> <install-command> editorconfig-checker-git

# i.e.
trizen -S editorconfig-checker-git

Usage

USAGE:
  -config string
        config
  -debug
        print debugging information
  -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-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
  -h    print the help
  -help
        print the help
  -ignore-defaults
        ignore default excludes
  -init
        creates an initial configuration
  -no-color
        dont print colors
  -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.

Configuration

The configuration is done via arguments or an .ecrc file.

A sample .ecrc file can look like this and will be used from your current working directory if not specified via the --config argument:

{
  "Verbose": false,
  "Debug": false,
  "IgnoreDefaults": false,
  "SpacesAftertabs": false,
  "NoColor": false,
  "Exclude": [],
  "AllowedContentTypes": [],
  "PassedFiles": [],
  "Disable": {
    // set these options to true to disable specific checks
    "EndOfLine": false,
    "Indentation": false,
    "InsertFinalNewline": false,
    "TrimTrailingWhitespace": false,
    "IndentSize": false,
    "MaxLineLength": false
  }
}

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 an config-path it will be created there.

By default the allowed_content_types are text/ and application/octet-stream(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 doesn't get removed.

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 blocks

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 indended line because it needs to be
`
// editorconfig-checker-enable

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 ignore-defaults 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$",
"\\.patch$",
"\\.css\\.map$",
"\\.js\\.map$",
"min\\.css$",
"min\\.js$"

Manually excluding

via configuration

In your .ecrc file you can exclude files with the "exclude" key which takes an array of regular expressions. This will get merged with the default excludes (if not ignored). You should remember to escape your regular expressions correctly. ;)

An .ecrc which would ignore all test files and all markdown files can look like this:

{
    "verbose": false,
    "ignore_defaults": false,
    "exclude": ["testfiles", "\\.md$"],
    "spaces_after_tabs": false,
    "disable": {
        "end_of_line": false,
        "trim_trailing_whitespace": false,
        "insert_final_newline": false,
        "indentation": false
    }
}
via arguments

If you want to play around how the tool would behave you can also pass the --exclude 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.

If you want to see which files the tool would check without checking them you can pass the --dry-run flag.

Docker

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

Continuous Integration

Mega-Linter

Instead of installing and configuring editorconfig-checker and all other linters in your project CI workflows (GitHub Actions & others), you can use Mega-Linter which does all that for you with a single assisted installation

Mega-Linter embeds editorconfig-checker by default in all its flavors, meaning that it will be run at each commit or Pull Request to detect any issue related to .editorconfig

If you want to use only editorconfig-checker and not the 70+ other linters, you can use the following .mega-linter.yml configuration file

ENABLE:
- EDITORCONFIG

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].