Skip to content

Commit d697a0f

Browse files
committed
Merge remote-tracking branch 'origin/master' into update-java
2 parents 5017342 + 45bb95b commit d697a0f

114 files changed

Lines changed: 1660 additions & 1032 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
build:
88
docker:
99
# specify the version you desire here
10-
- image: eclipse-temurin:21-alpine
10+
- image: eclipse-temurin:25-alpine
1111

1212
# Specify service dependencies here if necessary
1313
# CircleCI maintains a library of pre-built images

.claude/skills/angular/SKILL.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: angular
3+
description: Conventions for Angular applications
4+
---
5+
6+
## 1. In all setup files, the target should be esnext
7+
8+
### Example in `tsconfig.json`:
9+
10+
Replace:
11+
12+
```json
13+
{
14+
"compilerOptions": {
15+
"target": "es5",
16+
"lib": ["es5", "dom"],
17+
"types": ["cypress", "node"]
18+
},
19+
"include": ["**/*.ts"]
20+
}
21+
```
22+
23+
with
24+
25+
```json
26+
{
27+
"compilerOptions": {
28+
"target": "esnext",
29+
"lib": ["esnext", "dom"],
30+
"types": ["cypress", "node"]
31+
},
32+
"include": ["**/*.ts"]
33+
}
34+
```
35+
36+
## 2. Make sure that the code strictly follows all angular standards
37+
38+
Please find the list of alle angular standards on the following page: https://angular.dev/style-guide.
39+
It is of the utmost importance that all configuration, HTML, TypeScript, JavaScript, and everything that consists of an angular project, to follow these standards.
40+
Changes should be made accordingly.
41+
Modernize the build tooling too
42+
43+
## 3. Make sure that Angular projects are completely reactive with the usage of signals.
44+
45+
With the inception of signals, reactive programming for the front-end has been made easy. Make sure that, whenever possible, that the code uses signals instead of the typical subscriber model.
46+
Find information on how to do this with good practices over at: https://angular.dev/guide/signals
47+
Refactor subscribe() to resource()/rxResource()
48+
49+
## 4. Make sure to use new methods for deprecated classes
50+
51+
The `RouterTestingModule` and the `HttpClientTestingModule` have been deprecated. Can you make sure to replace the TypeScript declarations accordingly?
52+
53+
54+
From `RouterTestingModule`.
55+
56+
```text
57+
Use provideRouter or RouterModule/RouterModule.forRoot instead. This module was previously used to provide a helpful collection of test fakes, most notably those for Location and LocationStrategy. These are generally not required anymore, as MockPlatformLocation is provided in TestBed by default. However, you can use them directly with provideLocationMocks.
58+
```
59+
60+
From `HttpClientTestingModule`.
61+
62+
```text
63+
Add provideHttpClientTesting() to your providers instead.
64+
```
65+
66+
Use both definitions to make the changes wherever possible.
67+
68+
## 6. Update the build system, if necessary
69+
70+
Follow the documentation on https://angular.dev/tools/cli/build-system-migration to make a successful build migration
71+
72+
## 7. Use scss/css standards for scss files
73+
74+
In old projects, very little attention was given to scss standards.
75+
Here we want to make sure that all scss is being applied according to the scss documents over at:
76+
77+
1. https://sass-lang.com/documentation/syntax/
78+
2. https://sass-lang.com/documentation/
79+
80+
When possible, make sure to optimize the use of scss for grids.
81+
Documentation can be found here:
82+
83+
1. https://css-tricks.com/complete-guide-css-grid-layout/
84+
85+
## 8. Checklist
86+
87+
[] All targets in `tsconfig.json` files should be set to `esnext`
88+
[] No target should remain with old target compiler option versions
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
name: annotations
3+
description: Conventions for using annotations in all tests using Jupiter
4+
---
5+
6+
## 1. Make sure to use `@param:Value` eveywhere @Value is declared for Kotlin classes and files only
7+
8+
Remember to run tests after replacing all of them
9+
10+
## 2. Make sure to use interpolation prefixes for the `@Value` annotation in Kotlin classes and files only
11+
12+
### Example 1 (applying to params)
13+
14+
Replace this:
15+
16+
```kotlin
17+
class VirtualThreadsDemoApplication(
18+
val taskService: TaskService,
19+
@param:Value("\${org.jesperancinha.vtcc.tasks}") private val tasks: Int,
20+
)
21+
```
22+
23+
with this:
24+
25+
```kotlin
26+
class VirtualThreadsDemoApplication(
27+
val taskService: TaskService,
28+
@param:Value($$"${org.jesperancinha.vtcc.tasks}") private val tasks: Int,
29+
)
30+
```
31+
32+
### Example 2 (applying to fields, on lateinit vars
33+
34+
Replace this:
35+
36+
```kotlin
37+
class BankCompanyLauncherOtherPropertiesKotlinTest {
38+
/**
39+
* Properties and environment variables
40+
*/
41+
@Value($$"${environment}")
42+
private lateinit var environment: String
43+
}
44+
```
45+
46+
with this:
47+
48+
```kotlin
49+
class BankCompanyLauncherOtherPropertiesKotlinTest {
50+
/**
51+
* Properties and environment variables
52+
*/
53+
@field:Value($$"${environment}")
54+
private lateinit var environment: String
55+
}
56+
```
57+
58+
The same should be applied to annotation `@Autowired`, but only for non-test classes and only in Kotlin files.
59+
The same should be applied to annotation `@JsonProperty`, `@JsonDeserialize`, `@JsonAlias`, `@LocalServerPort`, but only in Kotlin files.
60+
Do not add `@Autowired`, or any form of it with a different target to any parameter. `@Autowired` usage should be removed from production code instead.
61+
62+
## 3. Checklist
63+
64+
[] Make sure there is no more use of `@Value` annotation being used directly
65+
[] Make sure no `@param:Value` has been changed in a Java file
66+
[] Check that all `@param:Value` annotations are used correctly

.claude/skills/docker/SKILL.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: docker
3+
description: Conventions for docker
4+
---
5+
6+
## 1. Update eclipse temurin image usages to the latest java version.
7+
8+
### Example 1:
9+
10+
If the latest java version is `25`and there is an image being used like:
11+
12+
```dockerfile
13+
FROM eclipse-temurin:21-alpine
14+
```
15+
16+
Then it should be updated to:
17+
18+
```dockerfile
19+
FROM eclipse-temurin:25-alpine
20+
```
21+
22+
### Example 2:
23+
24+
This example is only valid for CircleCI configuration files located in `.circleci/config.yml`.
25+
Replace this:
26+
27+
```yml
28+
docker:
29+
- image: eclipse-temurin:21-alpine
30+
```
31+
32+
with:
33+
34+
```yml
35+
docker:
36+
- image: eclipse-temurin:25-alpine
37+
```
38+
39+
## 2. Do not use `docker-compose`
40+
41+
The usage of `docker-compose` has been deprecated and in some cases it doesn't work anymore.
42+
Please replace `docker-compose` with `docker compose` everywhere, namely in `bash` scripts, `Makefile` and `Makefile.mk` files, `.md` files, all kinds of Markdown files, and other files you may find it.
43+
Leave all binary files untouched.
44+
45+
## 3. Checklist
46+
47+
[] No Dockerfile should use older Java version images
48+
[] No Testcontainers code should use older Java version images

.claude/skills/java/SKILL.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: java language patterns
3+
description: Conventions for using Java
4+
---
5+
6+
## 1. Use modern java conventions in the code and make necessary changes
7+
8+
Make sure to make the code as strict as possible to follow code conventions.
9+
Please use these sources:
10+
11+
1. https://www.oracle.com/java/technologies/javase/codeconventions-programmingpractices.html
12+
2. https://blog.jetbrains.com/idea/2024/02/java-best-practices/
13+
3. https://google.github.io/styleguide/javaguide.html

.claude/skills/jee/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Java Enterprise Edition Frameworks
3+
description: Conventions for using in all JEE frameworks. These are common standards for CDI
4+
---
5+
6+
## 1. Correct annotation usage for use-site targets
7+
8+
Constructor params annotated with `@Claim` should be injected with use-site target `param` as `@param:Claim`

.claude/skills/jvm/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: java language patterns
3+
description: Conventions for using in all JVM languages
4+
---
5+
6+
## 1. Remove all unused imports
7+
8+
If you find unused imports, please remove them. This is a good practice to keep the code clean and maintainable.

.claude/skills/kotlin/SKILL.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
name: kotlin patterns
3+
description: Conventions for using Kotlin
4+
---
5+
6+
## 1. Remove usage of `!!` operator
7+
8+
The `!!` operator should be avoided in Kotlin as it can lead to `NullPointerException` at runtime. Instead, use safe calls (`?.`) or the `let` scope function to handle nullable values more gracefully.
9+
10+
## 2. Remove the safe call operator (`?.`) when possible
11+
12+
Using the safe call operator (`?.`) is a good practice, but it should be used judiciously.
13+
It makes no sense to use this operator when the value is guaranteed to be non-null, as it can lead to unnecessary null checks and reduce code readability.
14+
15+
## 3. Avoid using `var` when possible
16+
17+
In Kotlin, it is recommended to use `val` instead of `var` whenever possible. This helps to make the code more readable and maintainable, as it makes it clear that the value of a variable is not expected to change.
18+
19+
## 4. Use Duration overload when possible
20+
21+
### Example 1
22+
23+
When using the `delay` function, it is recommended to use the overload that accepts a `Duration` parameter instead of a `Long` parameter. This makes the code more readable and easier to understand, as it clearly indicates the intended duration of the delay.
24+
25+
replace this:
26+
27+
```kotlin
28+
delay(100)
29+
```
30+
31+
with this:
32+
33+
```kotlin
34+
delay(100.milliseconds)
35+
```
36+
37+
Add import: `import kotlin.time.Duration.Companion.milliseconds`
38+
39+
## 5. Remove all code signatures
40+
41+
Code does not need to be signed. The code signature used to have some value, but in current times, the commit already has a signature.
42+
Old code may contain signatures that look like this:
43+
44+
```kotlin
45+
/**
46+
* Created by joao on 28-4-16.
47+
*/
48+
```
49+
50+
They should all be removed, as they are not needed and add no value to the code.
51+
52+
## 6. When using Kotlin code make sure to use the kotlin extensions for parsing
53+
54+
### Example 1
55+
56+
When finding this:
57+
58+
```kotlin
59+
.getForEntity("/tulips", String::class.java)
60+
```
61+
replace with:
62+
```kotlin
63+
.getForEntity<String>("/tulips")
64+
```
65+
66+
## 7. Update the usage of `CSVParser` which is now deprecated
67+
68+
This skill refers to the `CSVParser` from `org.apache.commons.csv.*`
69+
70+
### Example 1
71+
72+
Replace
73+
```kotlin
74+
val csvParser = CSVParser(reader, CSV_HEADER)
75+
```
76+
77+
with
78+
79+
```kotlin
80+
val csvParser = CSVParser.builder()
81+
.setReader(reader)
82+
.setFormat(CSV_HEADER).get()
83+
```
84+
85+
### Example 2
86+
87+
Replace this
88+
89+
```kotlin
90+
private val CSV_HEADER = DEFAULT
91+
.withHeader(
92+
"id",
93+
"description",
94+
"year",
95+
"value",
96+
"currency",
97+
"type",
98+
"diameterMM",
99+
"internalDiameterMM",
100+
"heightMM",
101+
"widthMM"
102+
)
103+
```
104+
105+
with:
106+
107+
```kotlin
108+
private val CSV_HEADER = CSVFormat.DEFAULT.builder()
109+
.setHeader(
110+
"id",
111+
"description",
112+
"year",
113+
"value",
114+
"currency",
115+
"type",
116+
"diameterMM",
117+
"internalDiameterMM",
118+
"heightMM",
119+
"widthMM"
120+
).get()
121+
```
122+
123+
## 8. Checklist
124+
125+
[ ] The code does not use the `!!` operator.
126+
[ ] The code does not use the safe call operator (`?.`) when the value is guaranteed to be non-null.
127+
[ ] The code uses `val` instead of `var` whenever possible.
128+
[ ] The code uses the `Duration` overload when using the `delay` function.
129+
[ ] The code does not contain any code signatures.
130+
[ ] The code uses the kotlin extensions for parsing when using Kotlin code.
131+
[ ] The code should not use the `CSVParser` constructuro directly

0 commit comments

Comments
 (0)