diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-08-24 07:54:01 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-08-24 07:54:01 +0000 |
| commit | da942624a4abd82797f563cf8c57f1124c5de435 (patch) | |
| tree | f7e4325a4783a77544e6ed1f0ac44ea844757fe8 /config | |
| parent | b299d57d6cc240381aed51f91e5a26f1e633d78d (diff) | |
Add TDD quality gate: detekt, coverage tracking, pre-commit hook; fix theme crash risk
CLAUDE.md now documents mandatory red-green-refactor TDD, a per-commit
quality gate (build, tests, lint, detekt, coverage-non-decrease,
WebView-JS justification, manifest permission diff, secret scan), and
why each check exists (tracing back to real bugs this audit found).
Wires up detekt (static analysis) and a standalone Jacoco setup
(scoped to data/readability/opml/work/stash -- ui/ Compose screens
are impractical to unit-test for coverage) via app/build.gradle.kts.
Bumped Kotlin/KSP to 2.0.21/2.0.21-1.0.28 to match detekt 1.23.8's
compatibility requirement.
Also fixes the themes.xml bug the lint gate immediately caught:
Theme.FeedReader's parent required API 29 while minSdk is 26 -- a
real crash risk on Android 8.0-9.0 devices. Swapped to the plain
(non-DayNight) DeviceDefault parent, since Compose already owns all
real theming via a hardcoded darkColorScheme() regardless of system
day/night state.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GMEkHeqKz6FLkmizowBTK
Diffstat (limited to 'config')
| -rw-r--r-- | config/detekt/baseline.xml | 77 | ||||
| -rw-r--r-- | config/detekt/detekt.yml | 16 |
2 files changed, 93 insertions, 0 deletions
diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml new file mode 100644 index 0000000..bd02fbe --- /dev/null +++ b/config/detekt/baseline.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" ?> +<SmellBaseline> + <ManuallySuppressedIssues/> + <CurrentIssues> + <ID>ComplexCondition:FeedParser.kt$FeedParser$inEntry && rel == "enclosure" && type?.startsWith("image/") == true && href != null</ID> + <ID>CyclomaticComplexMethod:ArticleListScreen.kt$@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class, ExperimentalCoroutinesApi::class) @Composable fun ArticleListScreen( feedId: String, onOpenArticle: (String) -> Unit, onBack: () -> Unit, onOpenFeedList: () -> Unit )</ID> + <ID>CyclomaticComplexMethod:FeedFetchWorker.kt$FeedFetchWorker$private suspend fun fetchOne(feed: FeedEntity, db: AppDatabase): Int</ID> + <ID>CyclomaticComplexMethod:FeedParser.kt$FeedParser$private fun parseAtom(parser: XmlPullParser): ParsedFeed</ID> + <ID>CyclomaticComplexMethod:FeedParser.kt$FeedParser$private fun parseRss(parser: XmlPullParser): ParsedFeed</ID> + <ID>CyclomaticComplexMethod:LinkReaderScreen.kt$@SuppressLint("SetJavaScriptEnabled") @OptIn(ExperimentalMaterial3Api::class) @Composable fun LinkReaderScreen(url: String, onBack: () -> Unit, onOpenLink: (String) -> Unit, onOpenBrowser: (String) -> Unit)</ID> + <ID>CyclomaticComplexMethod:ReaderScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable private fun ReaderContent( articleId: String, onBack: () -> Unit, onOpenLink: (String) -> Unit, onOpenBrowser: (String) -> Unit, hasPrevious: Boolean, hasNext: Boolean, onPrevious: () -> Unit, onNext: () -> Unit, onNextKeepUnread: () -> Unit )</ID> + <ID>LongMethod:AddFeedScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun AddFeedScreen(onDone: () -> Unit)</ID> + <ID>LongMethod:ArticleListScreen.kt$@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class, ExperimentalCoroutinesApi::class) @Composable fun ArticleListScreen( feedId: String, onOpenArticle: (String) -> Unit, onBack: () -> Unit, onOpenFeedList: () -> Unit )</ID> + <ID>LongMethod:FeedFetchWorker.kt$FeedFetchWorker$private suspend fun fetchOne(feed: FeedEntity, db: AppDatabase): Int</ID> + <ID>LongMethod:FeedListScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun FeedListScreen( onOpenFeed: (String) -> Unit, onOpenUnread: () -> Unit, onOpenOlder: () -> Unit, onOpenSaved: () -> Unit, onAddFeed: () -> Unit, onSettings: () -> Unit )</ID> + <ID>LongMethod:FeedParser.kt$FeedParser$private fun parseAtom(parser: XmlPullParser): ParsedFeed</ID> + <ID>LongMethod:FeedParser.kt$FeedParser$private fun parseRss(parser: XmlPullParser): ParsedFeed</ID> + <ID>LongMethod:LinkReaderScreen.kt$@SuppressLint("SetJavaScriptEnabled") @OptIn(ExperimentalMaterial3Api::class) @Composable fun LinkReaderScreen(url: String, onBack: () -> Unit, onOpenLink: (String) -> Unit, onOpenBrowser: (String) -> Unit)</ID> + <ID>LongMethod:MainActivity.kt$@Composable fun FeedReaderApp()</ID> + <ID>LongMethod:ReaderExtractor.kt$ReaderExtractor.<no name provided>$override fun onPageFinished(view: WebView, finishedUrl: String)</ID> + <ID>LongMethod:ReaderScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable private fun ReaderContent( articleId: String, onBack: () -> Unit, onOpenLink: (String) -> Unit, onOpenBrowser: (String) -> Unit, hasPrevious: Boolean, hasNext: Boolean, onPrevious: () -> Unit, onNext: () -> Unit, onNextKeepUnread: () -> Unit )</ID> + <ID>LongMethod:SettingsScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun SettingsScreen(onBack: () -> Unit)</ID> + <ID>LongParameterList:ArticleListScreen.kt$( article: ArticleListItem, highlighted: Boolean, showFeedName: Boolean, showReadState: Boolean, onClick: () -> Unit, onMarkReadFrom: () -> Unit )</ID> + <ID>LongParameterList:Daos.kt$FeedDao$( id: String, title: String, siteUrl: String?, lastFetchedAt: Long, etag: String?, lastModified: String?, lastError: String? )</ID> + <ID>LongParameterList:FeedListScreen.kt$( onOpenFeed: (String) -> Unit, onOpenUnread: () -> Unit, onOpenOlder: () -> Unit, onOpenSaved: () -> Unit, onAddFeed: () -> Unit, onSettings: () -> Unit )</ID> + <ID>LongParameterList:ReaderScreen.kt$( articleId: String, onBack: () -> Unit, onOpenLink: (String) -> Unit, onOpenBrowser: (String) -> Unit, hasPrevious: Boolean, hasNext: Boolean, onPrevious: () -> Unit, onNext: () -> Unit, onNextKeepUnread: () -> Unit )</ID> + <ID>LongParameterList:ReaderScreen.kt$( feedId: String, articleId: String, onBack: () -> Unit, onOpenLink: (String) -> Unit, onOpenBrowser: (String) -> Unit, onNavigateToArticle: (String) -> Unit )</ID> + <ID>LongParameterList:ReaderWebView.kt$( context: Context, onOpenLink: (String) -> Unit, onLongPressLink: (String) -> Unit = {}, onYouTubeVideo: (String) -> Unit = {}, onScrollChanged: (Int) -> Unit = {}, onPageFinished: (WebView) -> Unit = {} )</ID> + <ID>LongParameterList:ReaderWebView.kt$( url: String, onDismiss: () -> Unit, onOpenInBrowser: () -> Unit, onShare: () -> Unit, onSaveToStash: () -> Unit, onSaveForLater: () -> Unit )</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$10</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$11</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$3</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$4</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$5</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$6</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$7</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$8</ID> + <ID>MagicNumber:AppDatabase.kt$AppDatabase.Companion.<no name provided>$9</ID> + <ID>MagicNumber:Daos.kt$500</ID> + <ID>MagicNumber:FeedFetchWorker.kt$FeedFetchWorker$304</ID> + <ID>MagicNumber:ReaderWebView.kt$16f</ID> + <ID>MagicNumber:ReaderWebView.kt$9f</ID> + <ID>MagicNumber:StashClient.kt$StashClient$200</ID> + <ID>MagicNumber:StashClient.kt$StashClient$201</ID> + <ID>MagicNumber:StashClient.kt$StashClient$35</ID> + <ID>MagicNumber:StashClient.kt$StashClient$401</ID> + <ID>MagicNumber:StashClient.kt$StashClient$403</ID> + <ID>MagicNumber:StashClient.kt$StashClient$409</ID> + <ID>MatchingDeclarationName:ReaderWebView.kt$ReaderScrollPositions</ID> + <ID>MaxLineLength:Daos.kt$ArticleDao$"WHERE (articles.isRead = 0 OR articles.readAt >= :sinceFetch) AND (articles.publishedAt IS NULL OR articles.publishedAt >= :cutoff) "</ID> + <ID>MaxLineLength:Daos.kt$ArticleDao$"WHERE (articles.isRead = 0 OR articles.readAt >= :sinceFetch) AND articles.publishedAt IS NOT NULL AND articles.publishedAt < :cutoff "</ID> + <ID>MaxLineLength:Entities.kt$ArticleEntity$@ColumnInfo(index = true) override val feedId: String?</ID> + <ID>MaxLineLength:Entities.kt$ArticleEntity$val imageUrl: String? = null</ID> + <ID>MaxLineLength:Entities.kt$ArticleEntity$val readAt: Long? = null</ID> + <ID>MaxLineLength:LinkReaderScreen.kt$loadDataWithBaseURL(url, wrapReaderHtml(currentExtractedContent, extractedTitle), "text/html", "UTF-8", null)</ID> + <ID>MaxLineLength:LinkReaderScreen.kt$webView.loadDataWithBaseURL(url, wrapReaderHtml(currentExtractedContent, extractedTitle), "text/html", "UTF-8", null)</ID> + <ID>MaxLineLength:ReaderScreen.kt$loadDataWithBaseURL(baseUrl, wrapReaderHtml(content, article?.title, article?.publishedAt, article?.imageUrl), "text/html", "UTF-8", null)</ID> + <ID>MaxLineLength:ReaderScreen.kt$webView.loadDataWithBaseURL(baseUrl, wrapReaderHtml(content, article?.title, article?.publishedAt, article?.imageUrl), "text/html", "UTF-8", null)</ID> + <ID>MaxLineLength:ReaderWebView.kt$"<figure><a href=\"https://www.youtube.com/watch?v=$id\"><img src=\"https://i.ytimg.com/vi/$id/hq720.jpg\" alt=\"YouTube video\"></a><figcaption>▶ Watch on YouTube</figcaption></figure>"</ID> + <ID>MaxLineLength:SettingsScreen.kt$DropdownMenuItem(text = { Text("Highlight") }, onClick = { newRuleAction = FilterAction.HIGHLIGHT; actionMenuExpanded = false })</ID> + <ID>MaxLineLength:SettingsScreen.kt$DropdownMenuItem(text = { Text("Mute") }, onClick = { newRuleAction = FilterAction.MUTE; actionMenuExpanded = false })</ID> + <ID>NestedBlockDepth:AppDatabase.kt$AppDatabase.Companion.<no name provided>$override fun migrate(db: SupportSQLiteDatabase)</ID> + <ID>NestedBlockDepth:FeedFetchWorker.kt$FeedFetchWorker$private suspend fun fetchOne(feed: FeedEntity, db: AppDatabase): Int</ID> + <ID>NestedBlockDepth:FeedParser.kt$FeedParser$private fun parseAtom(parser: XmlPullParser): ParsedFeed</ID> + <ID>NestedBlockDepth:FeedParser.kt$FeedParser$private fun parseRss(parser: XmlPullParser): ParsedFeed</ID> + <ID>NestedBlockDepth:Opml.kt$Opml$fun parse(input: InputStream): List<OpmlFeed></ID> + <ID>ReturnCount:ReaderWebView.kt$<no name provided>$override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean</ID> + <ID>TooGenericExceptionCaught:AddFeedScreen.kt$e: Exception</ID> + <ID>TooGenericExceptionCaught:AppDatabase.kt$AppDatabase.Companion$e: Exception</ID> + <ID>TooGenericExceptionCaught:AppDatabase.kt$AppDatabase.Companion.<no name provided>$e: Exception</ID> + <ID>TooGenericExceptionCaught:FeedFetchWorker.kt$FeedFetchWorker$e: Exception</ID> + <ID>TooGenericExceptionCaught:MainActivity.kt$MainActivity$e: Exception</ID> + <ID>TooGenericExceptionCaught:MorningFetchReceiver.kt$MorningFetchReceiver$e: Exception</ID> + <ID>TooGenericExceptionCaught:MorningFetchReceiver.kt$MorningFetchReceiver.Companion$e: Exception</ID> + <ID>TooManyFunctions:Daos.kt$ArticleDao</ID> + </CurrentIssues> +</SmellBaseline> diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml new file mode 100644 index 0000000..442435a --- /dev/null +++ b/config/detekt/detekt.yml @@ -0,0 +1,16 @@ +# Builds on detekt's default ruleset (see app/build.gradle.kts: buildUponDefaultConfig = true). +# Only overrides/additions relative to the defaults belong here -- keep this file small so +# upgrading detekt pulls in sane new defaults automatically instead of us silently diverging. + +style: + MaxLineLength: + maxLineLength: 140 # several files carry long, deliberate rationale comments (see + # ReaderExtractor.kt) -- 120 (detekt's default) wrapped mid-explanation too aggressively. + ForbiddenComment: + active: false # this codebase deliberately doesn't use TODO/FIXME markers (see CLAUDE.md + # "why these checks") -- nothing to forbid. + +naming: + FunctionNaming: + ignoreAnnotated: ["Composable"] # Jetpack Compose's own naming convention is PascalCase for + # composable functions -- that's the correct style here, not a violation. |
