Adopt EditorConfig in the Project to Enforce Code Style Consistency
André,
lately I've started to adopt EditorConfig settings (.editorconfig
) in my repositories to enforce code style consistency. For example:
https://github.com/tajmone/awesome-interactive-fiction
I've found it a very good solution for it allows many modern editor to pick-up those settings automatically on a per-project base and enforce them without having to manually fiddle with settings like tabs and spaces, indentation width, file encodings, etc.
Furthermore, it's easy to integrate in Continuous Integration build tests via tools like ECLint, so that every commit and merge-request can be checked for code style consistency.
If it's OK with you, I could start by examining the current state of the repository, and then start implementing some code standards on some file extensions, one step at the time — of course, all of this would be in a dedicate branch, so that we might test and discuss it before merging anything.
Ideally, this should improve maintenance of the project, and simplify third party contributions too (most modern editors either support EditorConfig natively or via a free plug-in). That is, unless you think this might add complications for contributors.
The ECLint tool is also capable of automatically correcting any code deviations from the set standards, which means that it could be set to auto-fix commit and pull requests — although this is usually discouraged, except for minor things like changing EOLs, adding empty line at file ends, etc.
Not all file types and extensions have a formal and standard style code (which is the source of the problem, in most cases), but we could make arbitrary choices in the adoption of style conventions (e.g. spaces instead of tabs, etc.).
If you give me the greenlight, I could create a dedicated branch and start by dealing with those file extensions that are easy to handle (Git configurations, etc.).
Other extensions might be more critical for the project and require preliminary discussions — e.g. Lua files (plugins, .theme
, .lang
) and C++ sources (and Qt-related extensions). Especially so with auto-generated files, which might require rules overriding in some cases.
But I think that overall this would be a great improvement in the long term.
What do you think?