Skip to content

Commit

Permalink
Application-Server: Java Code Formatting with Prettier (#136)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix T.J. Dietrich <[email protected]>
  • Loading branch information
GODrums and FelixTJDietrich authored Nov 6, 2024
1 parent 1a1adb5 commit 37ef715
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 40 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/application-server-qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Application-Server QA

on:
pull_request:
paths:
- "server/application-server/**"
- "!server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/**"
push:
paths:
- "server/application-server/**"
- "!server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice/**"
branches: [develop]

jobs:
quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
- name: Run Prettier
run: npm run prettier:java:check
18 changes: 12 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive",
"java.completion.importOrder": ["#"],
"[java]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"tailwindCSS.experimental.classRegex": [
"cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]",
"cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"
"cva\\(([^)]*)\\)",
"[\"'`]([^\"'`]*).*?[\"'`]",
"cn\\(([^)]*)\\)",
"[\"'`]([^\"'`]*).*?[\"'`]"
],
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.testing.pytestArgs": ["."],
"python.testing.pytestEnabled": true,
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.testing.pytestArgs": ["."],
"python.testing.pytestEnabled": true,
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
Expand Down
137 changes: 137 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
"generate:api:application-server:clean": "rimraf webapp/src/app/core/modules/openapi",
"generate:api:intelligence-service:clean": "rimraf server/application-server/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice",
"generate:api:clean": "npm run generate:api:intelligence-service:clean && npm run generate:api:application-server:clean",

"generate:api:application-server-specs": "cd server/application-server && mvn verify -DskipTests=true -Dapp.profiles=specs",
"generate:api:intelligence-service-specs": "python -m server.intelligence-service.app.generate_openapi_yaml",
"generate:api:specs": "npm run generate:api:application-server-specs && npm run generate:api:intelligence-service-specs",

"generate:api:application-server-client": "npx openapi-generator-cli generate -i server/application-server/openapi.yaml -g typescript-angular -o webapp/src/app/core/modules/openapi --additional-properties fileNaming=kebab-case,withInterfaces=true --generate-alias-as-model",
"generate:api:intelligence-service-client": "npx openapi-generator-cli generate -i server/intelligence-service/openapi.yaml -g java --library resttemplate --api-package de.tum.in.www1.hephaestus.intelligenceservice.api --model-package de.tum.in.www1.hephaestus.intelligenceservice.model --invoker-package de.tum.in.www1.hephaestus.intelligenceservice --additional-properties useJakartaEe=true,performBeanValidation=true,generateClientAsBean=true,hideGenerationTimestamp=true --package-name de.tum.in.www1.hephaestus.intelligenceservice -o tmp/java-client && shx cp -r tmp/java-client/src/main/java/de/tum/in/www1/hephaestus/intelligenceservice server/application-server/src/main/java/de/tum/in/www1/hephaestus && rimraf tmp",
"generate:api:clients": "npm run generate:api:intelligence-service-client && npm run generate:api:application-server-client",

"generate:api:application-server": "npm run generate:api:application-server-specs && npm run generate:api:application-server:clean && npm run generate:api:application-server-client",
"generate:api:intelligence-service": "npm run generate:api:intelligence-service:clean && npm run generate:api:intelligence-service-specs && npm run generate:api:intelligence-service-client",
"generate:api": "npm run generate:api:intelligence-service && npm run generate:api:application-server"
"generate:api": "npm run generate:api:intelligence-service && npm run generate:api:application-server",
"prettier:java:check": "prettier --check server/application-server/src/**/*.java",
"prettier:java:write": "prettier --write server/application-server/src/**/*.java"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "2.13.5",
"prettier": "3.3.3",
"prettier-plugin-java": "2.6.5",
"rimraf": "6.0.1",
"shx": "0.3.4"
}
Expand Down
58 changes: 30 additions & 28 deletions project.code-workspace
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
{
"folders": [
{
"name": "Hephaestus",
"path": "./"
},
{
"name": "webapp",
"path": "./webapp"
},
{
"name": "server/application-server",
"path": "./server/application-server"
},
{
"name": "server/intelligence-service",
"path": "./server/intelligence-service"
},
{
"name": "server/webhook-ingest",
"path": "./server/webhook-ingest"
},
],
"settings": {
"java.compile.nullAnalysis.mode": "automatic",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
}
"folders": [
{
"name": "Hephaestus",
"path": "./",
},
{
"name": "webapp",
"path": "./webapp",
},
{
"name": "server/application-server",
"path": "./server/application-server",
},
{
"name": "server/intelligence-service",
"path": "./server/intelligence-service",
},
{
"name": "server/webhook-ingest",
"path": "./server/webhook-ingest",
},
],
"settings": {
"java.compile.nullAnalysis.mode": "automatic",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"java.configuration.updateBuildConfiguration": "interactive",
"java.completion.importOrder": ["#"],
},
}
4 changes: 4 additions & 0 deletions server/application-server/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tabWidth: 4
printWidth: 120
plugins:
- prettier-plugin-java
1 change: 0 additions & 1 deletion webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"karma-coverage": "2.2.1",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.1.0",
"prettier": "3.3.3",
"storybook": "8.3.4",
"typescript": "5.5.4"
}
Expand Down

0 comments on commit 37ef715

Please sign in to comment.