Files
floci/.github/workflows/checkstyle.yml
T
TATSUNO “Taz” Yasuhiro 76adb9a97e chore(style): Enforce NoVar rule on new files, existing bad files later (#4362)
* chore: ban var with Checkstyle in CI

Checkstyle runs tools/checkstyle/checkstyle.xml over src and compatibility-tests/sdk-test-java in its own workflow. It stays out of the Maven lifecycle because a full run takes about 30 seconds.

Code that already uses var is listed in tools/checkstyle/suppressions.xml, one entry per service and one per compatibility-tests file, so each can be cleaned and removed in its own PR.

* docs: point AGENTS.md and CONTRIBUTING.md at Checkstyle

* chore: load Checkstyle suppressions from checkstyle.xml

IDE plugins such as CheckStyle-IDEA set config_loc to the config directory and now apply the same suppressions as CI. Maven sets config_loc through propertyExpansion.

* chore: exclude files, not directories, from the var check

New files in services that still use var are now checked too.

* chore: exclude the renamed NativeDynamoDbJsonHandler files from the var check
2026-09-30 21:53:14 -05:00

54 lines
1.4 KiB
YAML

name: Checkstyle
# Runs tools/checkstyle/checkstyle.xml over src and compatibility-tests/sdk-test-java.
# Kept out of the Maven build lifecycle because parsing the whole tree takes about 30s.
on:
pull_request:
paths:
- 'src/**/*.java'
- 'compatibility-tests/sdk-test-java/src/**/*.java'
- 'tools/checkstyle/**'
- 'pom.xml'
- '.github/workflows/checkstyle.yml'
push:
branches:
- main
paths:
- 'src/**/*.java'
- 'compatibility-tests/sdk-test-java/src/**/*.java'
- 'tools/checkstyle/**'
- 'pom.xml'
- '.github/workflows/checkstyle.yml'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
checkstyle:
name: Checkstyle
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: '25'
distribution: 'temurin'
# Restore only. CI shard 1 owns saving this cache.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: |
maven-${{ runner.os }}-
- name: Run Checkstyle
run: ./mvnw -B checkstyle:check