Skip to content

Enable server checkstyle in CI and fix pre-existing violations#1125

Merged
krusche merged 1 commit into
developfrom
chore/enable-checkstyle-ci
Jun 20, 2026
Merged

Enable server checkstyle in CI and fix pre-existing violations#1125
krusche merged 1 commit into
developfrom
chore/enable-checkstyle-ci

Conversation

@krusche

@krusche krusche commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

Enables Checkstyle in CI for the server and fixes the violations that had silently accumulated because it was never enforced.

Why

The Checkstyle config (server/config/checkstyle/checkstyle.xml, maxWarnings = 0) existed but nothing ran it in CI:

  • server.Dockerfile builds with -x checkstyleMain -x checkstyleTest
  • run_tests.yml only ran ./gradlew test (which doesn't trigger checkstyle)

As a result, ./gradlew checkstyleMain on develop currently fails with 3 violations (verified on a clean develop checkout).

Changes

Fix existing violations (all introduced by #1089, behavior-preserving):

  • TopicRepository.searchTopics — two native-query lines exceeded the 200-char LineLength limit (Checkstyle counts tabs at width 8). Wrapped the OPEN/EXPIRED conditions onto continuation lines; the SQL is unchanged (newline = whitespace).
  • TopicService.getPublishedFromResearchGroup — added the required public-method Javadoc (@param/@return, as JavadocMethod mandates).

Enforce going forward:

  • Added a Run server checkstyle step (./gradlew checkstyleMain checkstyleTest) to run_tests.yml, before the test run so style issues fail fast.

Verification

  • ./gradlew checkstyleMain checkstyleTestBUILD SUCCESSFUL
  • ./gradlew compileJava → succeeds
  • CI runs the full test suite on this PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Added code style enforcement checks to the build pipeline to catch style violations early.
  • Documentation

    • Improved method documentation with additional Javadoc comments.
  • Style

    • Reformatted query code for improved readability.

Checkstyle was configured (server/config/checkstyle/checkstyle.xml) but never
enforced in CI: the server Docker build excludes it (`-x checkstyleMain
-x checkstyleTest`) and run_tests.yml only ran `test`. Three pre-existing
violations had accumulated on develop undetected:

- TopicRepository.searchTopics: two native-query lines exceeded the 200-char
  LineLength limit (checkstyle counts tabs at width 8). Wrapped the OPEN/EXPIRED
  conditions onto continuation lines — SQL semantics unchanged.
- TopicService.getPublishedFromResearchGroup: missing the required public-method
  Javadoc; added it.

Added a "Run server checkstyle" step (checkstyleMain + checkstyleTest) to
run_tests.yml, ahead of the test run so style issues fail fast.

Verified locally: checkstyleMain + checkstyleTest pass, compileJava succeeds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 20, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e9e212b8-2f31-4718-b1ba-bcefd5b5ba7d

📥 Commits

Reviewing files that changed from the base of the PR and between 4e054ad and 091a342.

📒 Files selected for processing (3)
  • .github/workflows/run_tests.yml
  • server/src/main/java/de/tum/cit/aet/thesis/repository/TopicRepository.java
  • server/src/main/java/de/tum/cit/aet/thesis/service/TopicService.java

Walkthrough

Adds checkstyleMain and checkstyleTest Gradle tasks as a pre-test CI step in the GitHub Actions workflow. Also reformats multi-line SQL conditions in TopicRepository's native query and adds a Javadoc block to TopicService.getPublishedFromResearchGroup — no logic changes.

Changes

Checkstyle CI enforcement and code hygiene

Layer / File(s) Summary
Checkstyle CI step
.github/workflows/run_tests.yml
Inserts a new step running checkstyleMain and checkstyleTest Gradle tasks in ./server before the existing test/coverage step.
SQL formatting and Javadoc
server/src/main/java/de/tum/cit/aet/thesis/repository/TopicRepository.java, server/src/main/java/de/tum/cit/aet/thesis/service/TopicService.java
Reformats long AND conditions in the searchTopics native SQL query across multiple lines; adds a Javadoc comment to getPublishedFromResearchGroup. No logic changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: enabling Checkstyle in CI and fixing pre-existing style violations across three files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/enable-checkstyle-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@krusche krusche merged commit 8b796eb into develop Jun 20, 2026
10 of 11 checks passed
@krusche krusche deleted the chore/enable-checkstyle-ci branch June 20, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants