Skip to content
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 default formatting #119

Merged
merged 8 commits into from
Jan 12, 2024
Merged

Add default formatting #119

merged 8 commits into from
Jan 12, 2024

Conversation

NicMcPhee
Copy link
Member

This turns on editor.formatOnSave in VS Code, so that when files are saved they will be automatically reformatted to a shared standard formatting so we have consistent formatting across everyone's work on this lab.

I'm using the RedHat Java formatter and MarkdownLint for Markdown files.

It turned out that several of the Markdown files had some issues, so I fixed those and am committing them as well while I'm here.

Fixes #112
Closes #101

  • Because we don't need Checkstyle anymore, and the Java formatter seems to properly handle the case people were concerned about.

Now that we're going with automatic formatting on saving, we don't really need `EditorConfig` anymore, so I'm removing references to that here.
These extensions provide a richer Markdown experience in VSCode, with better alignment with GitHub Markdown behavior.
This sets the RedHat formatter to be the default Java formatter, and the MarkdownLint as the default Markdown formatter.
This uses the MarkdownLint extension for VSCode to rationalize the formatting on all the Markdown files.
Now that we're formatting on save, we don't really need Checkstyle anymore.
Copy link
Member

@kklamberty kklamberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a concern that I don't have the time/brain cells to check about. Will there be files that are currently not following this formatting that will look like they've been changed (even if just in whitespace) if someone goes there and saves them? Is there any easy way to see if there are files that would currently be "fixed" upon saving, or is this similar enough to the checkstyle stuff that we are in the clear?

@NicMcPhee
Copy link
Member Author

If you switch to this branch and then do some "weird" things in VSCode, you can see it automatically "fix" them when you save.

As an example, there were concerns (#101) that Checkstyle wasn't being consistent about spacing around curly braces. So I tried things like:

String[] strings = { "Hello", "world" };

If I remove the spaces between, for example, the open curly brace and "Hello" and save, the space will magically re-appear.

The RedHat Java formatter that I'm using here is less aggressive than the Prettier formatter. Prettier changed the formatting in several other places in the Java code. In particular it reformatted the big strings in the tests so that each component was on its own line. We'll see that in action when I add Prettier to the iteration template.

Does that help?

kklamberty
kklamberty previously approved these changes Jan 12, 2024
Copy link
Member

@kklamberty kklamberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I won't muck up this PR with this, but I noticed we say things in KK_and_Nic.md lines 11 and 18 that put our name preferences in the past tense. Not sure why we did that, but might be worth fixing. Also, do people say "preferred" pronouns these days, or just "My pronouns are..."? I feel like that has shifted over time and might be good to update.

@NicMcPhee
Copy link
Member Author

Good point on the tense and phrasing. I'll make a new issue for that and see if I can get this guy merged in.

kklamberty
kklamberty previously approved these changes Jan 12, 2024
Copy link
Member

@kklamberty kklamberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link

sonarcloud bot commented Jan 12, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@kklamberty kklamberty self-requested a review January 12, 2024 22:51
@NicMcPhee NicMcPhee merged commit 9dee1de into main Jan 12, 2024
5 of 6 checks passed
@kklamberty kklamberty deleted the add-default-formatting branch January 12, 2024 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add default formatting on saving Fix inconsistency in how spacing is handled by Checkstyle
2 participants