lint: enable detekt rule: NestedScopeFunctions#334
lint: enable detekt rule: NestedScopeFunctions#334AdrianLeeElder wants to merge 11 commits intodevelopfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughEnabled the Detekt Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/src/test/kotlin/com/moneat/services/EventServiceTest.kt (1)
43-43:⚠️ Potential issue | 🟡 MinorAvoid wildcard imports.
Line 43 uses
java.util.*which violates the coding guideline requiring explicit imports. Replace with specific imports for the classes actually used.Proposed fix
-import java.util.* +import java.util.UUIDAs per coding guidelines: "Never use wildcard imports; always use explicit imports (e.g.,
import com.moneat.models.Userinstead ofimport com.moneat.models.*)"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@backend/src/test/kotlin/com/moneat/services/EventServiceTest.kt` at line 43, Replace the wildcard import `java.util.*` with explicit imports for only the classes used in EventServiceTest (e.g., `java.util.UUID`, `java.util.Date`, `java.util.List` or whichever specific types appear in the file); update the import statement(s) so there are no wildcard imports and only the concrete java.util types referenced by the file (look for usages of UUID, Date, List, etc., to determine which explicit imports to add).
🧹 Nitpick comments (1)
backend/src/main/kotlin/com/moneat/synthetics/routes/SyntheticsService.kt (1)
142-149: Refactor is correct, with minor redundancy.The logic correctly validates retry parameters when either
retryCountorretryIntervalMsis provided, using defaults for the missing value. However, when both parameters are non-null,validateRetryParamsis called twice with identical arguments.Consider consolidating to a single validation call:
Optional: Consolidate validation
val rc = request.retryCount val ri = request.retryIntervalMs - if (rc != null) { - validateRetryParams(rc, ri ?: RETRY_INTERVAL_MS_DEFAULT) - } - if (ri != null) { - validateRetryParams(rc ?: RETRY_COUNT_DEFAULT, ri) + if (rc != null || ri != null) { + validateRetryParams(rc ?: RETRY_COUNT_DEFAULT, ri ?: RETRY_INTERVAL_MS_DEFAULT) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@backend/src/main/kotlin/com/moneat/synthetics/routes/SyntheticsService.kt` around lines 142 - 149, The current code calls validateRetryParams twice when both request.retryCount (rc) and request.retryIntervalMs (ri) are set; replace the two conditional calls with a single validation: if either rc or ri is non-null, call validateRetryParams(rc ?: RETRY_COUNT_DEFAULT, ri ?: RETRY_INTERVAL_MS_DEFAULT) so you only validate once and still apply defaults when one value is missing (refer to request.retryCount, request.retryIntervalMs, validateRetryParams, RETRY_COUNT_DEFAULT, RETRY_INTERVAL_MS_DEFAULT).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@backend/src/test/kotlin/com/moneat/services/EventServiceTest.kt`:
- Line 43: Replace the wildcard import `java.util.*` with explicit imports for
only the classes used in EventServiceTest (e.g., `java.util.UUID`,
`java.util.Date`, `java.util.List` or whichever specific types appear in the
file); update the import statement(s) so there are no wildcard imports and only
the concrete java.util types referenced by the file (look for usages of UUID,
Date, List, etc., to determine which explicit imports to add).
---
Nitpick comments:
In `@backend/src/main/kotlin/com/moneat/synthetics/routes/SyntheticsService.kt`:
- Around line 142-149: The current code calls validateRetryParams twice when
both request.retryCount (rc) and request.retryIntervalMs (ri) are set; replace
the two conditional calls with a single validation: if either rc or ri is
non-null, call validateRetryParams(rc ?: RETRY_COUNT_DEFAULT, ri ?:
RETRY_INTERVAL_MS_DEFAULT) so you only validate once and still apply defaults
when one value is missing (refer to request.retryCount, request.retryIntervalMs,
validateRetryParams, RETRY_COUNT_DEFAULT, RETRY_INTERVAL_MS_DEFAULT).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 26c133e0-9e00-4c4b-b3e7-7ab87b1d6d7c
📒 Files selected for processing (6)
backend/detekt.ymlbackend/src/main/kotlin/com/moneat/dashboards/translation/GrafanaTranslator.ktbackend/src/main/kotlin/com/moneat/notifications/services/EmailService.ktbackend/src/main/kotlin/com/moneat/synthetics/routes/SyntheticsService.ktbackend/src/test/kotlin/com/moneat/services/EventServiceTest.ktbackend/src/test/kotlin/com/moneat/testsupport/RouteTestSupport.kt
Add concise KDoc on refactored helpers and related entry points (extractDisplayConfig, escapeHtml, sendEmail, updateTest, EventServiceTest.setup) to address docstring coverage feedback alongside existing class docs. Made-with: Cursor
4a1695e to
3cce801
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@backend/src/main/kotlin/com/moneat/dashboards/translation/GrafanaTranslator.kt`:
- Around line 250-251: The code is dropping non-integer numeric values by using
intOrNull on JSON nodes (e.g., valuePrim -> value in GrafanaTranslator), so
replace intOrNull with doubleOrNull (or parse contentOrNull with toDoubleOrNull)
and propagate a Double (or BigDecimal if higher precision is required) through
the mapNotNull blocks where value/valuePrim is used; update the parsing sites
that currently use valuePrim?.intOrNull (the three occurrences around value, and
the blocks handling thresholds/gauge/fill-opacity) to attempt double parsing
first and only convert to Int where downstream APIs explicitly require integers.
Ensure you handle the same null/empty logic (keep the contentOrNull checks and
the return@mapNotNull null behavior) so behavior is unchanged for missing
values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c7e96a94-aecc-4609-b208-e5f9f8f8429a
📒 Files selected for processing (1)
backend/src/main/kotlin/com/moneat/dashboards/translation/GrafanaTranslator.kt
backend/src/main/kotlin/com/moneat/dashboards/translation/GrafanaTranslator.kt
Outdated
Show resolved
Hide resolved
|
❌ Quality Gate failed Issues Measures |
Closes #298
Automated by auto-agent.
Summary by CodeRabbit
Refactor
Documentation
Tests
Chores