Research: editorconfig information extraction

Languages : INI file format

Parsing Methods : A custom implementation extended from python's ConfigParser library (see this prototype implementation )

Relevant Issues : https://github.com/coala/coala-quickstart/issues/79 , https://groups.google.com/forum/#!topic/editorconfig/XFV9AoXOhSU, https://github.com/coala/coala/issues/4098

The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles.

Common format :

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8
trim_trailing_whitespace = True

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4
insert_final_newline = True

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

Information of interest to coala:

  • Targeted file globs for a section and their styling preferences like
    • indent_style : tabs or space (Indentation bear)
    • charset
    • indent_size (Indentation bear)
    • insert_final_newline
    • trim_trailing_whitespace (SpaceConsistencyBear)
  • This information can be used to generate a .coafile according to the .editorconfig preferences of the project and maybe create a default section of global settings via quickstart.
  • It would also be possible to identify conflicts between .editorconfig file and .coafile (if any) and warn the users to resolve them.

Sub-issue of https://gitlab.com/coala/GSoC-2017/issues/21

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information