Suggestion: maintain EditorConfig (.editorconfig) files across all repos

(I possbily should start a topic on “common repository structure/layout” at this point :sweat_smile: , but this is the last one, I swear)

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.”

The benefit in contrast to lints/formatting checkers running in CI is that EditorConfig applies in the local editor, i.e. the formatting is correct without invoking any tool, neither locally nor in CI.

For examples see:

(Edit: In case this is something we would like to have, I’d of course prepare the relevant PRs.)

8 Likes

I love EditorConfig, and I agree we should standardize our formatting. For the large part I think the solution is to use nixfmt-rfc-style to avoid having to deal with nix settings in the EditorConfig, but we should standardize our markdown settings, and other languages or markups as they arise.

6 Likes

I’m in agreement with this. One major thing we should keep track of is making sure the editorconfig matches whichever formatter the language uses (prettier for JS/TS, black for PY, cargo fmt for RS, etc.)

5 Likes

On this note would it be helpful to have per language .editorconfigs on the wiki? If so I wouldn’t mind setting that up really quick.

2 Likes

sure thing. i think the best option is to copy our website editorconfig and go from there

3 Likes

I’ve added the pieces that I know to be correct, I am planning on going through and looking at other langs later, feel free to add to it, or even just comment some languages you would like to see up there.

Here’s the link to the page: .editorconfig | Auxolotl Wiki

3 Likes

Further updated to include:

  • Web Files
  • C Files
  • Shell Scripts
  • YAML
  • TOML
  • .*rc
  • Lockfiles
  • Git files
  • Keys

Also updated CSV to be more technically correct

2 Likes

Now that I think about it some more: I think we should set up some place, where stuff like repo structure guidelines (stuff like: name is kebab case, readme contains badges of SIGs that maintain the repo, editorconfig, and probably some other stuff I’m already forgetting) and other ‘if you set up a new Y for your SIG, you can follow this’ stuff is.

For now, I mainly want this to reduce the work required when setting up the basic stuff for new SIGs with out having to keep up with each forum thread (not that it’s bad we have so many forum threads - I’m genuinely amazed at the amount of stuff we’re getting done (are some of you even sleeping at all :stuck_out_tongue:) - but it’s still a lot to keep up with).

I’m not sure how beneficial this place is in the long term, but on the other hand: small deviations in each SIGs repo would lead to nobody knowing what exactly the plan was in the beginning. Preventing that from the start doesn’t seem like that bad of an idea.

3 Likes

Yep, totally agree! I was going to work on that later today. Page now exists: Project Standards | Auxolotl Wiki

4 Likes

On my side, it currently returns page not found

The only thing I will be a stickler about is for us to use tabs due to accessibility benefits.

7 Likes

The page was moved, I’ve fixed the link now

1 Like

Fully on board with this - tabs allow users to customize line spacing in their editor to their personal preference. Unfortunately in some languages it’s unavoidable (Python, Haskell iirc, come to mind) so we do need to make a decision there (if we even can… python…). But agreed, tabs where possible.

4 Likes

Also important to note, tabs are much better for refreshable braille displays, which is yet another argument for tabs as an accessibility standard

5 Likes

Hi! Is it possible to leave out indent_size = 4 from the config? Since indent style is set as tab, the size is only visible locally and users can configure that per their taste/needs. Unless I’m missing something, please let me know.

2 Likes

If nobody beats me to it, I’ll compile a list for the languages in the wiki article with how their tab support is (both language and formatter/linter wise) this afternoon.

4 Likes

I will note that the configs that have a formatted listed for them will replace tabs with spaces unfortunately. At the very least I know python and JS/TS does

1 Like

Prettier can be configured to use tabs. Python’s probably a non-starter because of syntax requirements, though.

1 Like

So, here’s the list:

  • nix: not (fully) supported by at least CppNix; configuring the indentation is currently not possbile with nixfmt-rfc-style either
  • python: supported by the language; but discouraged by the community’s formatting guidelines (PEP8); not officially supported in pycodestyle (in the sense that: the error for ‘using tabs instead of spaces’ can be suppressed, but the tabs may lead other checks to raise spurious errors)
  • Node.js:
  • rust: rustfmt can be configured
  • c and related: clang-format can be configured
  • shell: I would be surprised if there were any issues using tabs instead of spaces (at least I couldn’t find any info indicating the contrary)
  • web: I believe most of them are supported by prettier, which has a relevant option (see above)
  • JSON: yes; formatting via prettier
  • YAML: enforces indentation with spaces
  • TOML: has no indent (?)
  • *RC: I’ll be blunt here: I have no idea what this is
  • CSV: has no indent
  • Lockfiles: not manually modified
  • Git: not manually modified
  • Keys: not relevant
  • Make: enforces tabs anyway
  • Go: enforces tabs via gofmt
2 Likes

Thanks for that. I’ll go through and fix those today

2 Likes