Skip to content

Commit 0c65788

Browse files
authored
Merge pull request #68 from finos/main
sync develop with main
2 parents c486189 + fca7761 commit 0c65788

File tree

8 files changed

+104
-71
lines changed

8 files changed

+104
-71
lines changed

.github/renovate.json

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,56 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["config:base"],
3+
"extends": [
4+
"config:recommended"
5+
],
46
"prConcurrentLimit": 10,
57
"prHourlyLimit": 20,
8+
"dependencyDashboard": true,
9+
"dependencyDashboardApproval": false,
10+
"vulnerabilityAlerts": {
11+
"enabled": false
12+
},
13+
"enabledManagers": [
14+
"maven",
15+
"github-actions"
16+
],
617
"packageRules": [
718
{
8-
"description": "Update the Maven property rosetta.dsl.version when com.regnosys.rosetta releases a new version",
9-
"matchManagers": ["maven"],
19+
"description": "Highlight and prioritize rosetta.dsl.version updates",
20+
"matchManagers": [
21+
"maven"
22+
],
1023
"matchPackageNames": [
1124
"com.regnosys.rosetta:com.regnosys.rosetta",
1225
"rosetta.dsl.version"
1326
],
14-
"enabled": true
27+
"labels": [
28+
"rosetta"
29+
],
30+
"prPriority": 1,
31+
"automerge": false
1532
},
1633
{
17-
"description": "Disable all that are not maven AND not those names",
18-
"matchManagers": ["maven"],
19-
"excludePackageNames": [
20-
"com.regnosys.rosetta:com.regnosys.rosetta",
21-
"rosetta.dsl.version"
34+
"description": "Label GitHub Actions updates",
35+
"matchManagers": [
36+
"github-actions"
2237
],
23-
"enabled": false
38+
"labels": [
39+
"github-actions"
40+
]
41+
},
42+
{
43+
"description": "Label all other Maven dependency updates",
44+
"matchManagers": [
45+
"maven"
46+
],
47+
"labels": [
48+
"maven"
49+
],
50+
"matchPackageNames": [
51+
"!com.regnosys.rosetta:com.regnosys.rosetta",
52+
"!rosetta.dsl.version"
53+
]
2454
}
2555
]
2656
}

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828
with:
2929
fetch-depth: 0
3030

3131
# Java
3232
- name: Set up Java
33-
uses: actions/setup-java@v4
33+
uses: actions/setup-java@v5
3434
with:
3535
distribution: temurin
3636
java-version: ${{ inputs.java-version }}
@@ -41,7 +41,7 @@ jobs:
4141

4242
# Python
4343
- name: Set up Python
44-
uses: actions/setup-python@v5
44+
uses: actions/setup-python@v6
4545
with:
4646
python-version: ${{ inputs.python-version }}
4747
cache: pip

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
artifact_id: ${{ steps.get_artifact_id.outputs.artifact_id }}
1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020
with:
2121
fetch-depth: 0
2222

2323
- name: Set up Java
24-
uses: actions/setup-java@v4
24+
uses: actions/setup-java@v5
2525
with:
2626
distribution: temurin
2727
java-version: 21
@@ -75,12 +75,12 @@ jobs:
7575
runs-on: ubuntu-latest
7676
steps:
7777
- name: Checkout code
78-
uses: actions/checkout@v4
78+
uses: actions/checkout@v5
7979
with:
8080
fetch-depth: 0
8181

8282
- name: Set up Java
83-
uses: actions/setup-java@v4
83+
uses: actions/setup-java@v5
8484
with:
8585
distribution: temurin
8686
java-version: 21

.github/workflows/renovate.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# It uses the configuration file located at .github/renovate.json
44

55
name: Renovate
6+
67
on:
78
# Allows you to run this workflow manually from the Actions tab
89
workflow_dispatch:
@@ -13,25 +14,26 @@ on:
1314
jobs:
1415
renovate:
1516
runs-on: ubuntu-latest
16-
# Grants the GITHUB_TOKEN the necessary permissions for Renovate to read repository content and create pull requests.
17+
# 👇 Expanded permissions so Renovate can do everything it needs
1718
permissions:
18-
contents: write
19-
pull-requests: write
19+
contents: write # push branches, update files
20+
pull-requests: write # open/update PRs
21+
issues: write # create/update Dependency Dashboard issue
22+
security-events: read # read Dependabot vulnerability alerts
2023
steps:
21-
# Checks out the repository under $GITHUB_WORKSPACE, so your job can access it
22-
- uses: actions/checkout@v4
24+
# Checks out the repository under $GITHUB_WORKSPACE
25+
- uses: actions/checkout@v5
26+
2327
# Runs the Renovate GitHub Action
2428
- name: Renovate
25-
# Using a slightly newer version of the action
26-
uses: renovatebot/[email protected]
29+
uses: renovatebot/[email protected]
2730
with:
28-
# The token is required to create pull requests.
29-
token: ${{ secrets.GITHUB_TOKEN }}
30-
# Specifies the path to your Renovate configuration file.
31+
token: ${{ secrets.GITHUB_TOKEN }} # required to create PRs/issues
3132
configurationFile: .github/renovate.json
3233
env:
33-
RENOVATE_REPOSITORIES: ${{ github.repository }} # This tells Renovate to scan the current repo
34-
# Add a build and test job that depends on renovate
34+
RENOVATE_REPOSITORIES: ${{ github.repository }} # scan current repo
35+
36+
# Optional: run your build/test workflow after Renovate finishes
3537
build_and_test:
3638
needs: renovate
3739
uses: ./.github/workflows/build-and-test.yml

.github/workflows/scan-cve.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
name: depecheck_test
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222
- name: Setup JDK 21
23-
uses: actions/setup-java@v4
23+
uses: actions/setup-java@v5
2424
with:
2525
java-version: '21'
2626
distribution: 'temurin'

.github/workflows/scan-license.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ jobs:
5353
scan:
5454
runs-on: ubuntu-latest
5555
steps:
56-
- uses: actions/checkout@v4
56+
- uses: actions/checkout@v5
5757
- name: Set up JDK 21
58-
uses: actions/setup-java@v4
58+
uses: actions/setup-java@v5
5959
with:
6060
java-version: 21
6161
cache: maven

pom.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.finos</groupId>
1010
<artifactId>finos</artifactId>
11-
<version>7</version>
11+
<version>9</version>
1212
</parent>
1313

1414
<groupId>com.regnosys.rosetta.code-generators</groupId>
@@ -74,14 +74,14 @@
7474
<apache.commons.lang.version>3.13.0</apache.commons.lang.version>
7575
<apache.commons.text.version>1.11.0</apache.commons.text.version>
7676
<commons-io.version>2.19.0</commons-io.version>
77-
<guava.version>32.0.1-jre</guava.version>
77+
<guava.version>33.3.1-jre</guava.version>
7878

7979
<!-- Release -->
8080
<gpg.keyname>configured-by-release-profile</gpg.keyname>
8181
<repoServerHost>s01.oss.sonatype.org</repoServerHost>
8282
<stagingTimeoutInMinutes>20</stagingTimeoutInMinutes>
8383

84-
<rosetta.dsl.version>9.64.1</rosetta.dsl.version>
84+
<rosetta.dsl.version>9.65.1</rosetta.dsl.version>
8585

8686
<xtext.version>2.38.0</xtext.version>
8787
<guice.version>6.0.0</guice.version>
@@ -90,22 +90,22 @@
9090
<logback.version>1.5.6</logback.version>
9191

9292
<!-- test -->
93-
<junit.version>5.8.1</junit.version>
94-
<hamcrest.version>2.2</hamcrest.version>
93+
<junit.version>5.13.4</junit.version>
94+
<hamcrest.version>3.0</hamcrest.version>
9595

9696
<!-- plugin -->
97-
<maven-enforcer-plugin.version>3.3.0</maven-enforcer-plugin.version>
98-
<maven-checkstyle-plugin.version>3.4.0</maven-checkstyle-plugin.version>
99-
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
100-
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
101-
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
97+
<maven-enforcer-plugin.version>3.6.1</maven-enforcer-plugin.version>
98+
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
99+
<maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
100+
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
101+
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
102102
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
103-
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
103+
<maven-install-plugin.version>3.1.4</maven-install-plugin.version>
104104
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
105-
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
105+
<maven-javadoc-plugin.version>3.11.3</maven-javadoc-plugin.version>
106106
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
107107
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
108-
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
108+
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
109109
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
110110
<!-- Used by the Python generator -->
111111
<cdm.rosetta.source.path>build/common-domain-model/rosetta-source/src/main/rosetta</cdm.rosetta.source.path>
@@ -318,7 +318,7 @@
318318
<dependency>
319319
<groupId>org.jetbrains</groupId>
320320
<artifactId>annotations</artifactId>
321-
<version>13.0</version>
321+
<version>26.0.2-1</version>
322322
<scope>compile</scope>
323323
</dependency>
324324
</dependencies>
@@ -454,7 +454,7 @@
454454
<plugin>
455455
<groupId>org.apache.maven.plugins</groupId>
456456
<artifactId>maven-shade-plugin</artifactId>
457-
<version>3.5.0</version>
457+
<version>3.6.0</version>
458458
<configuration>
459459
<createDependencyReducedPom>true</createDependencyReducedPom>
460460
</configuration>
@@ -505,7 +505,7 @@
505505
<groupId>org.apache.maven.plugins</groupId>
506506
<artifactId>maven-javadoc-plugin</artifactId>
507507
<version>${maven-javadoc-plugin.version}</version>
508-
<configuration>
508+
<configuration combine.self="override">
509509
<failOnError>false</failOnError>
510510
</configuration>
511511
<executions>

src/main/java/com/regnosys/rosetta/generator/python/expressions/PythonExpressionGenerator.xtend

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,26 @@ class PythonExpressionGenerator {
180180
}
181181

182182
private def getGuardExpression(SwitchCaseGuard caseGuard, boolean isLambda){
183-
val enumGuard= caseGuard.getEnumGuard
184-
if (enumGuard!==null){
185-
return '''switchAttribute == rune_resolve_attr(«generateEnumString(enumGuard)»,"«caseGuard.getEnumGuard.getName()»")'''
183+
if (caseGuard === null) {
184+
throw new UnsupportedOperationException("Null SwitchCaseGuard")
186185
}
187-
if (caseGuard.getChoiceOptionGuard!==null){
188-
return '''rune_resolve_attr(switchAttribute,"«caseGuard.getChoiceOptionGuard.getName()»")'''
186+
val literalGuard = caseGuard.getLiteralGuard();
187+
if (literalGuard !== null) {
188+
return '''switchAttribute == «generateExpression(literalGuard, 0, isLambda)»'''
189189
}
190-
if (caseGuard.getSymbolGuard!==null){
191-
return '''rune_resolve_attr(switchAttribute,"«caseGuard.getSymbolGuard.getName()»")'''
190+
val enumGuard = caseGuard.getEnumGuard
191+
if (enumGuard !== null){
192+
return '''switchAttribute == rune_resolve_attr(«generateEnumString(enumGuard)»,"«enumGuard.getName()»")'''
192193
}
194+
val optionGuard = caseGuard.getChoiceOptionGuard
195+
if (optionGuard !== null){
196+
return '''rune_resolve_attr(switchAttribute,"«optionGuard.getName()»")'''
197+
}
198+
val dataGuard = caseGuard.getDataGuard
199+
if (dataGuard !== null){
200+
return '''rune_resolve_attr(switchAttribute,"«dataGuard.getName()»")'''
201+
}
202+
throw new UnsupportedOperationException("Unsupported SwitchCaseGuard type")
193203
}
194204

195205
private def String generateSwitchOperation(SwitchOperation expr, int ifLevel, boolean isLambda) {
@@ -204,8 +214,8 @@ class PythonExpressionGenerator {
204214

205215
for (pair : expr.cases.indexed) {
206216
val currentCase = pair.value
207-
val funcName= (currentCase.isDefault()) ? "_then_default" : "_then_"+ (pair.key+1)
208-
val thenExprDef= (currentCase.isDefault()) ? generateExpression(expr.getDefault(), 0, isLambda) : generateExpression(currentCase.getExpression(), ifLevel + 1, isLambda)
217+
val funcName = (currentCase.isDefault()) ? "_then_default" : "_then_"+ (pair.key+1)
218+
val thenExprDef = (currentCase.isDefault()) ? generateExpression(expr.getDefault(), 0, isLambda) : generateExpression(currentCase.getExpression(), ifLevel + 1, isLambda)
209219

210220
_thenFuncsBuilder.append(indent)
211221
_thenFuncsBuilder.append("def "+funcName + "():")
@@ -214,7 +224,7 @@ class PythonExpressionGenerator {
214224
_thenFuncsBuilder.append(" return "+ thenExprDef)
215225
_thenFuncsBuilder.newLine
216226

217-
if(currentCase.isDefault()){
227+
if (currentCase.isDefault()) {
218228
// Default else
219229
_switchLogicBuilder.append(indent)
220230
_switchLogicBuilder.append("else:")
@@ -223,21 +233,12 @@ class PythonExpressionGenerator {
223233
_switchLogicBuilder.append(" return ")
224234
_switchLogicBuilder.append(funcName)
225235
_switchLogicBuilder.append("()")
226-
}
227-
else{
228-
val guard =currentCase.getGuard()
229-
236+
} else {
237+
val guard = currentCase.getGuard()
230238
val prefix = (pair.key == 0) ? "if " : "elif "
231239
_switchLogicBuilder.append(indent)
232240
_switchLogicBuilder.append(prefix)
233-
if (guard.getLiteralGuard() !== null) {
234-
val guardExpr = generateExpression(guard.getLiteralGuard(), 0, isLambda)
235-
_switchLogicBuilder.append("switchAttribute == ")
236-
_switchLogicBuilder.append(guardExpr)
237-
} else {
238-
val guardExpr = getGuardExpression(guard, isLambda)
239-
_switchLogicBuilder.append(guardExpr)
240-
}
241+
_switchLogicBuilder.append(getGuardExpression(guard, isLambda))
241242
_switchLogicBuilder.append(":")
242243
_switchLogicBuilder.newLine()
243244
_switchLogicBuilder.append(indent)

0 commit comments

Comments
 (0)