-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .editorconfig file #247
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the long term we'll want to standardise on LF (as we have in mtasa-blue), but for now, since CRLF is the most common, we can stick with this.
In the future, we should have some sort of formatter that enforces all Lua formatting. We can change all CRLF to LF in one fell sloop, along with the Lua formatting enforcer.
Extra context about formatting: there are/were dreams of adding a Lua formatter that will enforce all Lua code to be formatted a certain way. We just needed to finish off trixnz/lua-fmt#21 and then apply it to this repo. Time and priorities meant that I never got round to this. Also, that project was abandoned even when I commented on that PR. That said, we applied lua-fmt to the admin2 resource, as a proof of concept.
We didn't apply it to the entire repository as we wanted to make sure we do only one mass formatting commit, instead of multiple over the years. (Unfortunately, it looks like this commit 2c6416a slipped through.)
Did commit 2c6416a standardize the repo on LF or CRLF? If LF, then I should update my settings here I think. Also, is there any way to perform a "simpler" format checking at just checks for proper indentation and line endings? That seems to be the most common pain point. |
Unfortunately I think it accidentally accidentally changed it to CRLF. It seems to edit all admin2 files, which iirc were previously standardised to LF by lua-fmt. I'm going to turn on pull request enforcements so we can catch this in code review next time. |
I think we could do that. Do you want to look into that, or shall I? |
I have zero experience with GitHub Actions/CI so it's probably best if you look into it. Looks like you're correct: If we can get consensus on the settings I've defined so far I'll go ahead and add a CONTRIBUTING.md file describing the desired coding style so far. A seperate PR to format existing code is probably called for too. |
Oh, hm, if our Maybe we can just comment out that line of the |
I think that's probably the best move for now. I'll open a separate issue for discussion. |
.editorconfig
Outdated
[*.lua] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = crlf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should comment this out too? The repo is currently mixed, right?
Going to switch this back to a draft PR until we make some more decisions in #250 |
I think it's safe to implement this now |
When merged, this will add an .editorconfig file to the repo to help enforce a consistent coding style. The following rules are set: