diff --git a/.github/workflows/qodana-check-duplicatedcode.yml b/.github/workflows/qodana-check-duplicatedcode.yml new file mode 100644 index 00000000000..d1ef9a0eaec --- /dev/null +++ b/.github/workflows/qodana-check-duplicatedcode.yml @@ -0,0 +1,49 @@ +name: Qodana - Duplicated Code + +on: + workflow_dispatch: + push: + branches: [ main, feature/** ] + pull_request: + branches: [ '**' ] + +concurrency: + group: ${{ github.workflow }}${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + qodana: + runs-on: ubuntu-latest + permissions: + contents: read + # PR check + checks: write + # PR comments + pull-requests: write + # SARIF upload + security-events: write + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - name: Maximize Build Space + if: runner.os == 'Linux' + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v2024.2.3 + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} + with: + # --config points to the DuplicatedCode-only Qodana config + args: + --config,${{ github.workspace }}/qodana-configs/duplicated-code/qodana.yaml + cache-default-branch-only: true + # pr-mode off means that the whole repo should be checked for duplicate code, instead of just copy/pastes within the PR + pr-mode: false + - uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json diff --git a/qodana-configs/duplicated-code/README.md b/qodana-configs/duplicated-code/README.md new file mode 100644 index 00000000000..241ee267263 --- /dev/null +++ b/qodana-configs/duplicated-code/README.md @@ -0,0 +1,3 @@ +# Duplicated Code Check + +This check only runs the Qodana DuplicatedCode check and should post duplicated code to [Github PRs](../../.github/workflows/qodana-check-duplicatedcode.yml). diff --git a/qodana-configs/duplicated-code/qodana.yaml b/qodana-configs/duplicated-code/qodana.yaml new file mode 100644 index 00000000000..16f79ec5cce --- /dev/null +++ b/qodana-configs/duplicated-code/qodana.yaml @@ -0,0 +1,10 @@ +version: 1.0 +linter: jetbrains/qodana-jvm-community:latest +projectJDK: "21" +bootstrap: ./gradlew :plugin-core:sdk-codegen:generateSdks :plugin-core:jetbrains-community:generateTelemetry :plugin-toolkit:jetbrains-rider:generateModels +exclude: + - name: All +dot-net: + solution: ReSharper.AWS.sln +include: + - name: DuplicatedCode diff --git a/qodana.yaml b/qodana.yaml index 2bcd68b4ac2..9e1380e1ddc 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -61,3 +61,4 @@ include: - name: SimplifiableServiceRetrieving - name: QuickFixGetFamilyNameViolation - name: TokenSetInParserDefinition + - name: DuplicatedCode