Skip to content

Add detekt - #193

Merged
mmathieum merged 2 commits into
masterfrom
mm/add_detekt
Jul 31, 2026
Merged

Add detekt#193
mmathieum merged 2 commits into
masterfrom
mm/add_detekt

Conversation

@mmathieum

Copy link
Copy Markdown
Member

@mmathieum mmathieum self-assigned this Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mmathieum, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b79bd82c-1c27-4753-8e13-44b783ebe730

📥 Commits

Reviewing files that changed from the base of the PR and between 89f1b42 and bb5c628.

📒 Files selected for processing (8)
  • detekt-baseline.xml
  • src/main/java/org/mtransit/android/commons/provider/gtfs/GTFSProviderDBHelperUtils.kt
  • src/main/java/org/mtransit/android/commons/provider/poi/POIProviderContract.kt
  • src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt
  • src/main/java/org/mtransit/android/commons/provider/vehiclelocations/VehicleLocationProvider.kt
  • src/test/java/org/mtransit/android/commons/HtmlUtilsTest.kt
  • src/test/java/org/mtransit/android/commons/provider/GTFSRealTimeProviderTest.kt
  • src/test/java/org/mtransit/android/commons/provider/gbfs/data/api/v3/GBFSv30ApiTests.kt

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Introduce detekt baseline and clean up initial rule violations

⚙️ Configuration changes 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Add a detekt baseline to enable static analysis without blocking existing findings.
• Reformat a few production Kotlin files to satisfy detekt line-length/style rules.
• Update unit tests’ long string literals to avoid MaxLineLength violations.
Diagram

graph TD
  A["Gradle build"] --> B["detekt"] --> C["detekt-baseline.xml"] --> D["Kotlin sources"]
  B --> E["Unit tests"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Enable detekt without a baseline (fix everything up-front)
  • ➕ No suppression debt
  • ➕ Immediate codebase-wide improvement
  • ➖ High initial effort; likely blocks adoption/CI due to existing findings
  • ➖ Creates noisy PRs dominated by cleanup rather than functional work
2. Adopt format-only tooling first (ktlint/spotless), detekt later
  • ➕ Auto-fixes the bulk of line-length/formatting issues with minimal review overhead
  • ➕ Lets detekt focus later on higher-signal semantic rules
  • ➖ Doesn’t provide detekt’s semantic/code-smell coverage
  • ➖ Still requires a detekt onboarding step later
3. Enable detekt with a reduced rule set instead of a broad baseline
  • ➕ Smaller baseline; less suppression to pay down
  • ➕ Encourages incremental tightening of rules
  • ➖ Requires additional up-front tuning and team agreement on rule scope
  • ➖ Some issues won’t be detected until broader rules are enabled

Recommendation: Baseline-first onboarding is a pragmatic approach to start running detekt without blocking the team. To prevent long-term baseline debt, consider adding guardrails (e.g., fail CI if the baseline grows, or track baseline count trend) and gradually shrink the baseline as code is touched.

Files changed (8) +364 / -17

Refactor (4) +12 / -4
GTFSProviderDBHelperUtils.ktWrap long initDbTable call for style compliance +3/-1

Wrap long initDbTable call for style compliance

• Reformats the long initDbTable invocation across multiple lines. This is a readability/style change with no functional impact.

src/main/java/org/mtransit/android/commons/provider/gtfs/GTFSProviderDBHelperUtils.kt

POIProviderContract.ktSplit long exception messages to satisfy MaxLineLength +6/-2

Split long exception messages to satisfy MaxLineLength

• Rewraps long UnsupportedOperationException messages into multi-line formatting. Behavior is unchanged; improves detekt compliance.

src/main/java/org/mtransit/android/commons/provider/poi/POIProviderContract.kt

GTFSRealTimeTripUpdatesProvider.ktSplit long log line to avoid line-length violations +2/-1

Split long log line to avoid line-length violations

• Breaks a long MTLog.i message into concatenated string segments while preserving the emitted text.

src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt

VehicleLocationProvider.ktSuppress MaxLineLength for projection map builder block +1/-0

Suppress MaxLineLength for projection map builder block

• Adds @Suppress("MaxLineLength") before the large projection map definition to document an intentional style exception.

src/main/java/org/mtransit/android/commons/provider/vehiclelocations/VehicleLocationProvider.kt

Tests (3) +44 / -13
HtmlUtilsTest.ktRewrap long HTML/base64 literals in tests +36/-9

Rewrap long HTML/base64 literals in tests

• Splits long HTML and base64 string literals (and corresponding expected strings) into concatenated lines to satisfy detekt line-length rules.

src/test/java/org/mtransit/android/commons/HtmlUtilsTest.kt

GTFSRealTimeProviderTest.ktReflow long KDoc comment for readability +2/-1

Reflow long KDoc comment for readability

• Wraps a long documentation comment into multiple lines to satisfy style checks. No test behavior changes.

src/test/java/org/mtransit/android/commons/provider/GTFSRealTimeProviderTest.kt

GBFSv30ApiTests.ktSplit long JSON/expected strings in GBFS v3 tests +6/-3

Split long JSON/expected strings in GBFS v3 tests

• Reformats long embedded JSON strings and expected text values using concatenation to avoid MaxLineLength violations.

src/test/java/org/mtransit/android/commons/provider/gbfs/data/api/v3/GBFSv30ApiTests.kt

Other (1) +308 / -0
detekt-baseline.xmlAdd detekt baseline for existing findings +308/-0

Add detekt baseline for existing findings

• Adds a detekt baseline listing current issues (complexity, long methods, max line length, etc.) so detekt can be enabled without failing on the existing codebase.

detekt-baseline.xml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR appears intended to introduce Detekt into the commons-android codebase (per the PR title and linked issue), while also applying formatting changes (mostly line wrapping) to Kotlin sources and tests.

Changes:

  • Adds a detekt-baseline.xml file containing the current Detekt findings baseline.
  • Wraps long strings and method calls in several test and main Kotlin files.
  • Adds a local @Suppress("MaxLineLength") to allow an intentionally long projection-map builder chain.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/java/org/mtransit/android/commons/provider/GTFSRealTimeProviderTest.kt Wraps a long KDoc line.
src/test/java/org/mtransit/android/commons/provider/gbfs/data/api/v3/GBFSv30ApiTests.kt Wraps long JSON/test strings across multiple concatenations.
src/test/java/org/mtransit/android/commons/HtmlUtilsTest.kt Wraps long HTML/base64 test strings.
src/main/java/org/mtransit/android/commons/provider/vehiclelocations/VehicleLocationProvider.kt Adds @Suppress("MaxLineLength") for a long fluent builder chain.
src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt Wraps a long log message string.
src/main/java/org/mtransit/android/commons/provider/poi/POIProviderContract.kt Wraps long exception message construction lines.
src/main/java/org/mtransit/android/commons/provider/gtfs/GTFSProviderDBHelperUtils.kt Wraps a long initDbTable(...) call (but still keeps args on one long line).
detekt-baseline.xml Adds a Detekt baseline file.

Comment thread detekt-baseline.xml
@mmathieum
mmathieum merged commit 316d0d2 into master Jul 31, 2026
9 of 10 checks passed
@mmathieum
mmathieum deleted the mm/add_detekt branch July 31, 2026 22:56
montransit added a commit to mtransitapps/mtransit-for-android that referenced this pull request Jul 31, 2026
…parser':

- commons: Add `detekt` mtransitapps/commons#836
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-st-hyacinthe-transport-collectif-bus-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-moose-jaw-transit-bus-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-ottawa-oc-transpo-bus-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-mrc-nicolet-yamaska-bili-bus-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
montransit added a commit to mtransitapps/ca-ottawa-oc-transpo-train-android that referenced this pull request Aug 1, 2026
…parser':

- commons: `download()` > remove `Accept: application/zip` for ZIP files (revert #834)
- commons: Add `detekt` mtransitapps/commons#836
- commons: `mt-download.yml` > omit `--ref` on default branch to avoid `mt-sync-code-data.yml` starting with the wrong hash mtransitapps/commons#835
- commons: `download()` > `Accept: application/zip` for ZIP files mtransitapps/commons#834
- commons-android: GTFS-RT > Trip Updates > never ignore CANCELLED trips because too much into the future mtransitapps/commons-android#194
- commons-android: `Schedule` > + `hasRealTimeOrCancelled`
- commons-android: Add `detekt` mtransitapps/commons-android#193
- commons-android: GTFS-RT > ignore trip updates too much into the future... mtransitapps/commons-android#192
- commons-java: Add `detekt` mtransitapps/commons-java#46
- parser: Add `detekt` mtransitapps/parser#84
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