Andreas Svanberg
1554d4bc27
All checks were successful
Build and test / build-and-test (push) Successful in 11m55s
Fixes #43 by introducing [Prettier](https://prettier.io/). Prettier is an extremely opinionated formatter. It will reformat every single line according to its style. There are virtually no configuration options so there can be no discussion about formatting rules. There are two parameters that are configurable; indent length and line length. Indent length has been set to 4 because that's the Java standard. Line length defaults to 80 but has been increased to 100. The rational for this is that Prettier was created for JavaScript which is much less verbose than Java. Not only does every Java line start with 8 spaces of indentation vs. JavaScripts 0 or 2, it also has types wile JavaScript does not and uses `const` for variable declarations. Compare the two below examples as well as an actual example from the source code that is too long for the default 80 characters. I have no problem dropping down to the default 80 if that is preferred I just felt that with the average length of a line of Java code being pretty long, excessive wrapping would reduce readability. ```javascript const attributes = { ... }; ``` ```java Map<String, String> attributes = Map.of( ... ); ``` Or the following real code which is 97 characters long. ```java Set<ProjectParticipant> contributors = daisyAPI.getContributors(project.getIdentifier()); ``` Reviewed-on: #44 Reviewed-by: Tom Zhao <tom.zhao@dsv.su.se> Co-authored-by: Andreas Svanberg <andreass@dsv.su.se> Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
6 lines
274 B
Plaintext
6 lines
274 B
Plaintext
# Prettier enforces LF line endings in all files
|
|
# If git is configured with core.autocrlf=true, it may convert LF to CRLF when
|
|
# checking out files depending on your OS. This will cause Prettier to change it
|
|
# causing Git to show every file as modified.
|
|
*.java text eol=lf
|