M4444 / TMatrix

Terminal based replica of the digital rain from The Matrix.
GNU General Public License v2.0
382 stars 14 forks source link

Added .editorconfig file #18

Closed Br1ght0ne closed 5 years ago

Br1ght0ne commented 5 years ago

When working on #17, I (again) used spaces instead of tabs as the project tries to.

EditorConfig is a tool aimed at standardising simple formatting rules for software projects. Here is an .editorconfig file that has sensible defaults and uses tabs for completions, C++ source files and CMakeLists.txt.

M4444 commented 5 years ago

Sure, we can add it. I would just reduce it to the essentials:

[*]
charset = utf-8
indent_style = tab
tab_width = 8

If something more is needed it can always be added later.

Also I'm not sure I understand insert_final_newline. Does it just insert an empty line at the end and why would you want that?

Br1ght0ne commented 5 years ago

Also I'm not sure I understand insert_final_newline. Does it just insert an empty line at the end and why would you want that?

It just adds a newline (\n) at the end of every file, thus adhering to the POSIX standards. See Why should text files end with a newline? | StackOverflow.

Br1ght0ne commented 5 years ago

Also, I'm not sure on tab_width = 8. This is just a visual thing for the editors, and 8 spaces for a tab seems... Overkill. (subjective)

how a part of Parser.cpp looks in my emacs with 8 spaces

M4444 commented 5 years ago

Also I'm not sure I understand insert_final_newline. Does it just insert an empty line at the end and why would you want that?

It just adds a newline (\n) at the end of every file, thus adhering to the POSIX standards. See Why should text files end with a newline? | StackOverflow.

Oh, ok we can add that. I thought it added another empty line.

M4444 commented 5 years ago

Also, I'm not sure on tab_width = 8. This is just a visual thing for the editors, and 8 spaces for a tab seems... Overkill. (subjective)

It does matter here because after indenting with tabs, spaces are used for precise alignment, and the code is already aligned assuming a tab width of 8. As one example see src/tmatrix.cpp, line 56.

Users can always set constant tab width in their editors but it will be their fault if the code isn't aligned for them.

Br1ght0ne commented 5 years ago

It does matter here because after indenting with tabs, spaces are used for precise alignment, and the code is already aligned assuming a tab width of 8. As one example see src/tmatrix.cpp, line 56.

Thank you for clarifying.

I incorporated your suggestions, and also added trim_trailing_whitespace = true - because trailing whitespace never helped anybody.

M4444 commented 5 years ago

I incorporated your suggestions, and also added trim_trailing_whitespace = true - because trailing whitespace never helped anybody.

I like this in principle, but in markdown files two trailing spaces can (and here in CONTRIBUTING.md are) used as a line break. Creating special cases for this would just be messier so I would just leave it out.

Also I'd remove everything above line 8. The style of the config file is pretty verbose by itself so there's no need to explain things further.

Br1ght0ne commented 5 years ago

Sure, thanks!

M4444 commented 5 years ago

Nice, thank you!