2017 © Pedro Peláez
 

library editorconfig-checker

A tool to verify that your files follow the rules of your .editorconfig

image

mstruebing/editorconfig-checker

A tool to verify that your files follow the rules of your .editorconfig

  • Tuesday, March 14, 2017
  • by mstruebing
  • Repository
  • 1 Watchers
  • 1 Stars
  • 83 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

editorconfig-checker

Logo, (*1)

This is a command-line tool to check if given files implement your .editorconfig rules., (*2)

Build Status Coverage Status Code Climate Issue Count psr2 composer.lock Total Downloads Daily Downloads Monthly Downloads Latest Stable Version Latest Unstable Version License, (*3)

What?

This is a tool to check if your files consider your .editorconfig. 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., (*4)

Sample Output, (*5)

Installation

Installation via composer is recommended:, (*6)

composer require --dev editorconfig-checker/editorconfig-checker
./vendor/bin/ec

# or in a composer-script just
ec

Otherwise you could clone the repository and execute the script manually., (*7)

git clone git@github.com:editorconfig-checker/editorconfig-checker.php.git
./editorconfig-checker.php/bin/ec

Usage

If you installed it via composer you have a binary in your bin folder called editorconfig-checker. Then you could create a script in your composer.json like this:, (*8)

"scripts": {
    "check-editorconfig": "editorconfig-checker src/*"
}

You could also check for single files with explicit call them e.g. ec src/index.php Shell globbing is possible for example: ec ./src/EditorconfigChecker/{Cli,Fix}/*, (*9)

If you want to filter the files you could do this via the -e|--exclude parameter, (*10)

CAUTION after using this parameter you HAVE TO write a single regular expression or string or your files you want to check will be interpreted as the exclude pattern., (*11)

If you use a regular expression you should always put single quotes around it because the special characters(e.g. |, *, . or whatever) will be interpreted by your shell before if you don't., (*12)

Some examples:, (*13)

# will filter all files with json extension
bin/ec -e '\\.json$' ./*
bin/ec --exclude '\\.json$' ./*

# will only filter all files which has TestFiles in their name
bin/ec -e TestFiles ./*
bin/ec --exclude TestFiles ./*

# will filter all files which has TestFiles in their name and json as extension
bin/ec -e 'TestFiles|\\.json$' ./*
bin/ec --exclude 'TestFiles|\\.json$' ./*

# will filter all files which has TestFiles in their name and exclude dotfiles
bin/ec -d -e TestFiles  ./*
bin/ec --dotfiles --exclude TestFiles  ./*

# will filter all files which has TestFiles in their name and exclude dotfiles and will try to fix issues if they occur
bin/ec -a -d -e TestFiles  ./*
bin/ec --auto-fix --dotfiles --exclude TestFiles  ./*

# will don't use default excludes and filter all files which has TestFiles in their name
bin/ec -a -i -d -e TestFiles  ./*
bin/ec --auto-fix --ignore-defaults --dotfiles --exclude TestFiles  ./*

If you just want to filter for one string you don't have to worry and if you want to filter for more strings you could also pass the -e|--exclude option more than once like this:, (*14)

bin/ec -e vendor -e myBinary -e someGeneratedFile -e myPicture ./*
bin/ec --exclude vendor --exclude myBinary --exclude someGeneratedFile --exclude myPicture ./*

If you installed it manually you would have to do something like this:, (*15)

<PATH/TO/ROOT/OF/THIS/REPOS>/bin/ec src/*.php

The exit value is 0 if no error occurred and 1 to 254 - every error adds 1 to the exit value. 255 means that there is more than 254 violations of your .editorconfig rules., (*16)

Usage output:, (*17)

Usage:
editorconfig-checker [OPTIONS] <FILE>|<FILEGLOB>
available options:
-a, --auto-fix
    will automatically fix fixable issues(insert_final_newline, end_of_line, trim_trailing_whitespace, tabs to spaces)
-d, --dotfiles
    use this flag if you want to exclude dotfiles
-e <PATTERN>, --exclude <PATTERN>
    string or regex to filter files which should not be checked
-i, --ignore-defaults
        will ignore default excludes, see README for details
-h, --help
    will print this help text
-l, --list-files
    will print all files which are checked to stdout

Disabling single lines

It is possible to disable single lines with placing a comment - or theoretically any other string which includes editorconfig-disable-line on that line. It is planned in future releases to also have the possibility to disable single rules and also blocks of codes., (*18)

Example as it is working now:, (*19)

    $x = 'this variable is indented false' // editorconfig-disable-line

Default ignores:

'vendor',
'node_modules',
'\.DS_Store',
'\.gif$',
'\.png$',
'\.bmp$',
'\.jpg$',
'\.svg$',
'\.ico$',
'\.lock$',
'\.eot$',
'\.woff$',
'\.woff2$',
'\.ttf$',
'\.bak$',
'\.bin$',
'\.min\.js$',
'\.min\.css$',
'\.js\.map$',
'\.css\.map$',
'\.pdf$',
'\.jpg$',
'\.jpeg$',
'\.zip$',
'\.gz$',
'\.7z$',
'\.bz2$',
'\.log$',

Suggestions are welcome!, (*20)

Additional Notes

I use semantic versioning so every breaking change will result in the increase of the major version., (*21)

If you encounter any bugs or anything else please open an issue with as many details as possible., (*22)

You should use the -l option after installing and configuring this tool to see if all files are checked., (*23)

The auto-fix parameter puts a copy of every original file which gets fixed in /tmp/editorconfig-checker.php/<filename>-<timestamp>-<sha1>, (*24)

Support

If you have any questions 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., (*25)

The Versions

14/03 2017

dev-master

9999999-dev

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

14/03 2017

3.0.2

3.0.2.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

14/02 2017

3.0.1

3.0.1.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

09/02 2017

3.0.0

3.0.0.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

07/02 2017

2.3.7

2.3.7.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

02/02 2017

2.2.6

2.2.6.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

02/02 2017

2.2.5

2.2.5.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

02/02 2017

2.2.4

2.2.4.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

02/02 2017

1.2.3

1.2.3.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

01/02 2017

1.1.3

1.1.3.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

30/01 2017

1.1.2

1.1.2.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

30/01 2017

1.1.0

1.1.0.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires

30/01 2017

1.0.0

1.0.0.0

A tool to verify that your files follow the rules of your .editorconfig

  Sources   Download

MIT

The Development Requires