Skip to content

feat(marketplace): add detekt-rules-koin ruleset#9070

Open
kirich1409 wants to merge 2 commits into
detekt:mainfrom
kirich1409:add-koin-detekt-rules
Open

feat(marketplace): add detekt-rules-koin ruleset#9070
kirich1409 wants to merge 2 commits into
detekt:mainfrom
kirich1409:add-koin-detekt-rules

Conversation

@kirich1409
Copy link
Copy Markdown

Summary

Adds detekt-rules-koin to the marketplace — a Detekt extension with 51 rules for Koin 4.x.

  • Enforces best practices and catches common anti-patterns in Koin usage via static analysis
  • Works without type resolution (usesTypeResolution: false)
  • Available on Maven Central: dev.androidbroadcast.rules.koin:detekt-koin4-rules

Rule categories

Category Count
Service Locator Anti-patterns 5
Module DSL 14
Scope Management 8
Platform (Android, Compose, Ktor) 8
Architecture 4
Koin Annotations 12

Checklist

  • Entry added in alphabetical position
  • ruleset ID matches ruleSetId in RuleSetProvider
  • All 51 rule names listed
  • usesTypeResolution: false
  • tags: ["ruleset"]

Adds detekt-rules-koin — 51 static analysis rules for Koin 4.x,
covering service locator anti-patterns, module DSL, scope management,
platform-specific and Koin Annotations rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 20, 2026 06:07
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.01%. Comparing base (433bb05) to head (988622c).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9070      +/-   ##
============================================
- Coverage     85.04%   85.01%   -0.03%     
+ Complexity     4422     4420       -2     
============================================
  Files           569      569              
  Lines         12303    12282      -21     
  Branches       2672     2673       +1     
============================================
- Hits          10463    10442      -21     
+ Misses          680      678       -2     
- Partials       1160     1162       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

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 adds the detekt-rules-koin extension to the Detekt marketplace, providing 51 static analysis rules for Koin 4.x dependency injection framework. The ruleset enforces best practices across service locator patterns, module DSL, scope management, platform-specific code (Android, Compose, Ktor), architecture, and Koin annotations.

Changes:

  • Added detekt-rules-koin marketplace entry with 51 rules for Koin 4.x static analysis
  • Configured entry with usesTypeResolution: false and appropriate ruleset metadata
  • Listed all 51 rule names in alphabetical order

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +243 to +304
{
title: "detekt-rules-koin",
description:
"51 rules for Koin 4.x — enforces best practices and catches common anti-patterns via static analysis.",
repo: "https://github.com/androidbroadcast/Koin-Detekt",
ruleset: "koin-rules",
rules: [
"ActivityFragmentKoinScope",
"AndroidContextNotFromKoin",
"AnnotatedClassImplementsNestedInterface",
"AnnotationProcessorNotConfigured",
"CircularModuleDependency",
"CloseableWithoutOnClose",
"ConflictingBindings",
"ConstructorDslAmbiguousParameters",
"DeprecatedKoinApi",
"DuplicateBindingWithoutQualifier",
"EmptyModule",
"EnumQualifierCollision",
"ExcessiveCreatedAtStart",
"FactoryInScopeBlock",
"GenericDefinitionWithoutQualifier",
"GetConcreteTypeInsteadOfInterface",
"InjectedParamWithNestedGenericType",
"InvalidNamedQualifierCharacters",
"KoinAnnotationOnExtensionFunction",
"KoinInjectInPreview",
"KoinViewModelOutsideComposable",
"KtorApplicationKoinInit",
"KtorRequestScopeMisuse",
"KtorRouteScopeMisuse",
"LayerBoundaryViolation",
"MissingModuleAnnotation",
"MissingScopeClose",
"MissingScopedDependencyQualifier",
"MixingDslAndAnnotations",
"ModuleAsTopLevelVal",
"ModuleIncludesOrganization",
"NoGetOutsideModuleDefinition",
"NoGlobalContextAccess",
"NoInjectDelegate",
"NoKoinComponentInterface",
"NoKoinGetInApplication",
"OverrideInIncludedModule",
"ParameterTypeMatchesReturnType",
"PlatformImportRestriction",
"RememberKoinModulesLeak",
"ScopeAccessInOnDestroy",
"ScopeDeclareWithActivityOrFragment",
"ScopedDependencyOutsideScopeBlock",
"ScopedWithoutQualifier",
"SingleAnnotationOnObject",
"SingleForNonSharedDependency",
"StartKoinInActivity",
"TooManyInjectedParams",
"UnassignedQualifierInWithOptions",
"ViewModelAnnotatedAsSingle",
"ViewModelAsSingleton",
],
usesTypeResolution: false,
tags: ["ruleset"],
},
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The entry is not in alphabetical position. According to case-insensitive alphabetical sorting, "detekt-rules-koin" should be placed between "Detekt Rule Authors" (around line 179) and "Doist detekt-rules" (around line 193), not after "UseInvokeForOperator". The comment at the end of the file (line 444) explicitly states "add your ruleset in alphabetical order."

Copilot uses AI. Check for mistakes.
Comment thread website/src/data/marketplace.js Outdated
Co-authored-by: Matthew Haughton <3flex@users.noreply.github.com>
@detekt-ci
Copy link
Copy Markdown
Collaborator

Warnings
⚠️ This PR is approved with no milestone set. If merged, it won't appear in the detekt release notes.

Generated by 🚫 dangerJS against 988622c

Copy link
Copy Markdown
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

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

LGTM

@cortinico cortinico enabled auto-merge (squash) March 14, 2026 01:36
@cortinico cortinico requested a review from 3flex March 14, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants