diff --git a/.github/renovate.json b/.github/renovate.json index d0229dc..bc7704c 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,26 +1,56 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:base"], + "extends": [ + "config:recommended" + ], "prConcurrentLimit": 10, "prHourlyLimit": 20, + "dependencyDashboard": true, + "dependencyDashboardApproval": false, + "vulnerabilityAlerts": { + "enabled": false + }, + "enabledManagers": [ + "maven", + "github-actions" + ], "packageRules": [ { - "description": "Update the Maven property rosetta.dsl.version when com.regnosys.rosetta releases a new version", - "matchManagers": ["maven"], + "description": "Highlight and prioritize rosetta.dsl.version updates", + "matchManagers": [ + "maven" + ], "matchPackageNames": [ "com.regnosys.rosetta:com.regnosys.rosetta", "rosetta.dsl.version" ], - "enabled": true + "labels": [ + "rosetta" + ], + "prPriority": 1, + "automerge": false }, { - "description": "Disable all that are not maven AND not those names", - "matchManagers": ["maven"], - "excludePackageNames": [ - "com.regnosys.rosetta:com.regnosys.rosetta", - "rosetta.dsl.version" + "description": "Label GitHub Actions updates", + "matchManagers": [ + "github-actions" ], - "enabled": false + "labels": [ + "github-actions" + ] + }, + { + "description": "Label all other Maven dependency updates", + "matchManagers": [ + "maven" + ], + "labels": [ + "maven" + ], + "matchPackageNames": [ + "!com.regnosys.rosetta:com.regnosys.rosetta", + "!rosetta.dsl.version" + ] } ] } diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8e7d0c8..3075732 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -24,13 +24,13 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 # Java - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: temurin java-version: ${{ inputs.java-version }} @@ -41,7 +41,7 @@ jobs: # Python - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ inputs.python-version }} cache: pip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e56728..b1958af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,12 +16,12 @@ jobs: artifact_id: ${{ steps.get_artifact_id.outputs.artifact_id }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: temurin java-version: 21 @@ -75,12 +75,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: temurin java-version: 21 diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 17d42bc..f777b97 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -3,6 +3,7 @@ # It uses the configuration file located at .github/renovate.json name: Renovate + on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -13,25 +14,26 @@ on: jobs: renovate: runs-on: ubuntu-latest - # Grants the GITHUB_TOKEN the necessary permissions for Renovate to read repository content and create pull requests. + # 👇 Expanded permissions so Renovate can do everything it needs permissions: - contents: write - pull-requests: write + contents: write # push branches, update files + pull-requests: write # open/update PRs + issues: write # create/update Dependency Dashboard issue + security-events: read # read Dependabot vulnerability alerts steps: - # Checks out the repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + # Checks out the repository under $GITHUB_WORKSPACE + - uses: actions/checkout@v5 + # Runs the Renovate GitHub Action - name: Renovate - # Using a slightly newer version of the action - uses: renovatebot/github-action@v40.2.2 + uses: renovatebot/github-action@v43.0.12 with: - # The token is required to create pull requests. - token: ${{ secrets.GITHUB_TOKEN }} - # Specifies the path to your Renovate configuration file. + token: ${{ secrets.GITHUB_TOKEN }} # required to create PRs/issues configurationFile: .github/renovate.json env: - RENOVATE_REPOSITORIES: ${{ github.repository }} # This tells Renovate to scan the current repo - # Add a build and test job that depends on renovate + RENOVATE_REPOSITORIES: ${{ github.repository }} # scan current repo + + # Optional: run your build/test workflow after Renovate finishes build_and_test: needs: renovate uses: ./.github/workflows/build-and-test.yml diff --git a/.github/workflows/scan-cve.yml b/.github/workflows/scan-cve.yml index 3f66944..4a3578b 100644 --- a/.github/workflows/scan-cve.yml +++ b/.github/workflows/scan-cve.yml @@ -18,9 +18,9 @@ jobs: name: depecheck_test steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup JDK 21 - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: '21' distribution: 'temurin' diff --git a/.github/workflows/scan-license.yml b/.github/workflows/scan-license.yml index 30b6b3f..b9704f6 100644 --- a/.github/workflows/scan-license.yml +++ b/.github/workflows/scan-license.yml @@ -53,9 +53,9 @@ jobs: scan: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up JDK 21 - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: 21 cache: maven diff --git a/pom.xml b/pom.xml index 9a4f0a7..bbf0813 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.finos finos - 7 + 9 com.regnosys.rosetta.code-generators @@ -74,14 +74,14 @@ 3.13.0 1.11.0 2.19.0 - 32.0.1-jre + 33.3.1-jre configured-by-release-profile s01.oss.sonatype.org 20 - 9.64.1 + 9.65.1 2.38.0 6.0.0 @@ -90,22 +90,22 @@ 1.5.6 - 5.8.1 - 2.2 + 5.13.4 + 3.0 - 3.3.0 - 3.4.0 - 3.1.0 - 3.8.1 - 2.22.2 + 3.6.1 + 3.6.0 + 3.5.0 + 3.14.0 + 3.5.3 3.1.1 - 2.5.2 + 3.1.4 2.8.2 - 3.5.0 + 3.11.3 3.1.1 1.6.13 - 3.2.4 + 3.2.8 3.3.1 build/common-domain-model/rosetta-source/src/main/rosetta @@ -318,7 +318,7 @@ org.jetbrains annotations - 13.0 + 26.0.2-1 compile @@ -454,7 +454,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.5.0 + 3.6.0 true @@ -505,7 +505,7 @@ org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc-plugin.version} - + false diff --git a/src/main/java/com/regnosys/rosetta/generator/python/expressions/PythonExpressionGenerator.xtend b/src/main/java/com/regnosys/rosetta/generator/python/expressions/PythonExpressionGenerator.xtend index 009aa93..654ffe7 100644 --- a/src/main/java/com/regnosys/rosetta/generator/python/expressions/PythonExpressionGenerator.xtend +++ b/src/main/java/com/regnosys/rosetta/generator/python/expressions/PythonExpressionGenerator.xtend @@ -180,16 +180,26 @@ class PythonExpressionGenerator { } private def getGuardExpression(SwitchCaseGuard caseGuard, boolean isLambda){ - val enumGuard= caseGuard.getEnumGuard - if (enumGuard!==null){ - return '''switchAttribute == rune_resolve_attr(«generateEnumString(enumGuard)»,"«caseGuard.getEnumGuard.getName()»")''' + if (caseGuard === null) { + throw new UnsupportedOperationException("Null SwitchCaseGuard") } - if (caseGuard.getChoiceOptionGuard!==null){ - return '''rune_resolve_attr(switchAttribute,"«caseGuard.getChoiceOptionGuard.getName()»")''' + val literalGuard = caseGuard.getLiteralGuard(); + if (literalGuard !== null) { + return '''switchAttribute == «generateExpression(literalGuard, 0, isLambda)»''' } - if (caseGuard.getSymbolGuard!==null){ - return '''rune_resolve_attr(switchAttribute,"«caseGuard.getSymbolGuard.getName()»")''' + val enumGuard = caseGuard.getEnumGuard + if (enumGuard !== null){ + return '''switchAttribute == rune_resolve_attr(«generateEnumString(enumGuard)»,"«enumGuard.getName()»")''' } + val optionGuard = caseGuard.getChoiceOptionGuard + if (optionGuard !== null){ + return '''rune_resolve_attr(switchAttribute,"«optionGuard.getName()»")''' + } + val dataGuard = caseGuard.getDataGuard + if (dataGuard !== null){ + return '''rune_resolve_attr(switchAttribute,"«dataGuard.getName()»")''' + } + throw new UnsupportedOperationException("Unsupported SwitchCaseGuard type") } private def String generateSwitchOperation(SwitchOperation expr, int ifLevel, boolean isLambda) { @@ -204,8 +214,8 @@ class PythonExpressionGenerator { for (pair : expr.cases.indexed) { val currentCase = pair.value - val funcName= (currentCase.isDefault()) ? "_then_default" : "_then_"+ (pair.key+1) - val thenExprDef= (currentCase.isDefault()) ? generateExpression(expr.getDefault(), 0, isLambda) : generateExpression(currentCase.getExpression(), ifLevel + 1, isLambda) + val funcName = (currentCase.isDefault()) ? "_then_default" : "_then_"+ (pair.key+1) + val thenExprDef = (currentCase.isDefault()) ? generateExpression(expr.getDefault(), 0, isLambda) : generateExpression(currentCase.getExpression(), ifLevel + 1, isLambda) _thenFuncsBuilder.append(indent) _thenFuncsBuilder.append("def "+funcName + "():") @@ -214,7 +224,7 @@ class PythonExpressionGenerator { _thenFuncsBuilder.append(" return "+ thenExprDef) _thenFuncsBuilder.newLine - if(currentCase.isDefault()){ + if (currentCase.isDefault()) { // Default else _switchLogicBuilder.append(indent) _switchLogicBuilder.append("else:") @@ -223,21 +233,12 @@ class PythonExpressionGenerator { _switchLogicBuilder.append(" return ") _switchLogicBuilder.append(funcName) _switchLogicBuilder.append("()") - } - else{ - val guard =currentCase.getGuard() - + } else { + val guard = currentCase.getGuard() val prefix = (pair.key == 0) ? "if " : "elif " _switchLogicBuilder.append(indent) _switchLogicBuilder.append(prefix) - if (guard.getLiteralGuard() !== null) { - val guardExpr = generateExpression(guard.getLiteralGuard(), 0, isLambda) - _switchLogicBuilder.append("switchAttribute == ") - _switchLogicBuilder.append(guardExpr) - } else { - val guardExpr = getGuardExpression(guard, isLambda) - _switchLogicBuilder.append(guardExpr) - } + _switchLogicBuilder.append(getGuardExpression(guard, isLambda)) _switchLogicBuilder.append(":") _switchLogicBuilder.newLine() _switchLogicBuilder.append(indent)