generated from hmcts/api-hmcts-crime-template
-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (31 loc) · 824 Bytes
/
code-analysis.yml
File metadata and controls
36 lines (31 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Code analysis
on:
pull_request:
branches:
- master
- main
jobs:
pmd-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
- uses: pmd/pmd-github-action@v2
id: pmd
with:
rulesets: '.github/pmd-ruleset.xml'
sourcePath: 'src/main/java'
analyzeModifiedFilesOnly: false
- name: Fail build if there are violations
if: always()
run: |
VIOLATIONS="${{ steps.pmd.outputs.violations }}"
if [ -n "$VIOLATIONS" ] && [ "$VIOLATIONS" != "0" ]; then
echo "PMD found $VIOLATIONS violations"
exit 1
fi