Skip to content

EditorConfig

Tristano Ajmone requested to merge editorconfig into master

André, this is my initial setup for EditorConfig support, as discussed in #137 (closed).

Right now, I've enforced code styles only in Git related configuration files and shell scripts:

  • Git and other repository related configurations (eg. .*.yml and .editorconfig):
    • Indent with spaces (size unset).
    • Enforce LF end-of-lines.
    • UTF-8 encoding.
    • Trim trailing whitespace.
    • Enforce empty line at EOF.
  • Shell scripts:
    • Indent with tabs (size unset).
    • Enforce LF end-of-lines.
    • UTF-8 encoding.
    • Trim trailing whitespace.
    • Enforce empty line at EOF.

I think these are reasonable settings, from what I've gathered via some research (e.g. using tabs in shell scripts is strongly adviced for various reasons).

These settings simplify working on the project with EditorConfig-compliant editors. For example, I work with Sublime Text, which picks them up automatically and overrides my default settings and uses those indicated in .editorconfig instead — which means I don't have to worry about tabs, EOL settings and trimming whitespace (it handles it automatically).

From here onward, I'll try to look into other file types/extensions used in the project, and start testing with EClint to see which settings would be best, and how much bulk-editing it would require to make all files compliant to the test. Of course, for any critical file extension I'll consult you before proceding.

The overall approach I've taken is not to impose any defaults for unspecified extensions, but to target the project file types one by one instead. Since there are numerous file extensions in the project (due to extras/ contents) this seemed the best approach.

Travis CI Tests

I've also created a Travis CI test branch on my GitHub fork:

Where I use EClint to validate the EditorConfig settings for the whole project.

Since here on GitLab you're using a .gitlab-ci.yml configuration, you might consider looking at my .travis.yml file to include EClint validation in the Highlight repository:

dist: trusty

git:
  depth: false

install:
  - npm install -g eclint

script:
  - eclint check

Merge request reports