Commit Graph

18 Commits

Author SHA1 Message Date
1554d4bc27 Enforce code formatting via Prettier (#44)
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>
2024-12-02 14:17:59 +01:00
ccac2c1cf8 Enable creating an API using Spring Web (#5)
All checks were successful
Build and test / build-and-test (push) Successful in 6m54s
SciPro will have to provide information to the upcoming student portal. Wicket does not have the ability to serve JSON in the usual REST way and is only able to serve HTML. The most common way to write JSON over HTTP API:s in Java is using Spring Web, but currently SciPro uses Guice for dependency injection rather than Spring which makes adding Spring Web a bit more tricky.

This pull request attempts to solve this by doing the following;
* Replacing Guice with Spring
* Adding a new API module that uses Spring Web
* Turning the entire system into a standard Spring Boot web application

The hope is that these changes will bring the following benefits;
* Harmonize our web stack (Daisy uses Spring and the new lecture hall system is full Spring Boot)
* Enable easy development of a traditional JSON over HTTP API
* Ease future recruitment by using the most common Java web frameworks

Reviewed-on: #5
Reviewed-by: niat8586 <nico@dsv.su.se>
Co-authored-by: Andreas Svanberg <andreass@dsv.su.se>
Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
2024-11-06 11:23:28 +01:00
fred-fri
63a1bbd08c added daisytarget to ignore 2013-11-14 12:04:53 +09:00
fred-fri
4537111d2c edit 2013-10-04 18:08:24 +09:00
fred-fri
11925cebdc added *.log to gitignore 2013-09-24 12:08:12 +09:00
fred-fri
25fba0e5de added core and view target folders to gitignore 2013-09-19 12:45:20 +09:00
Jona Ekenberg
2fcd079183 hej 2013-01-18 19:55:18 +01:00
029a5ba020 added /classes/ to ignore 2013-01-08 16:24:38 +01:00
260b223e84 git now ignores the out folder 2012-12-18 15:53:35 +01:00
fred
6f0717846d added line to .gitignore 2012-05-29 10:26:25 +09:00
anto-gom
be9b940d3c Changed .gitignore to include Thumbs.db 2012-03-02 14:17:58 +01:00
Tom Vahlman
5c8e086431 Added Intellij files to .gitignore. 2011-12-13 11:13:53 +01:00
Alex Robsahm
8d83ed907b Added matched panels 2011-12-07 14:26:13 +01:00
Daniel Hasselrot
619d05c2fc Ignoring eclipse build files 2011-11-14 16:31:18 +01:00
Fredrik Norberg
7294571f77 started on addCheckListToProjectPanel 2011-08-12 11:07:32 +02:00
Fredrik Norberg
6e36c1b685 Implemented creation of checklist templates 2011-08-01 17:10:19 +02:00
Robin Eklund
b4930e436a Re-merging shibIntegration branch after additional development:
Unit tests(needs some refactoring), added a status page for server-side parameters(may be moved/hidden soon), some minor refactoring, etc
2011-07-13 16:20:50 +02:00
Fredrik Norberg
f2a7ce59e9 added gitignore 2011-07-13 12:08:51 +02:00