docs: improve API reference coverage for pub.dev#30
docs: improve API reference coverage for pub.dev#30KirthiSaiT wants to merge 2 commits intomaster-wayne7:developfrom
Conversation
Add /// Dart doc comments to all public classes, methods, and fields. Every public method now documents its parameters, return value, and includes dart code block examples. Closes master-wayne7#28
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds extensive Dartdoc across the public API, marks and documents a deprecated Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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)
lib/src/models/language.dart (1)
228-229:⚠️ Potential issue | 🟡 MinorUse ISO 639-1 code
kmfor Khmer instead ofkh.The documentation at line 8 states "Language codes follow ISO 639 where available," but the implementation uses
'kh'instead of the standard ISO 639-1 code'km'. Other languages in this file correctly follow ISO 639-1 (e.g.,'kn'for Kannada,'ko'for Korean), making this inconsistent. Update the case statement to use'km'as the primary code, and optionally retain'kh'as a backward-compatible alias if needed for existing asset files.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/src/models/language.dart` around lines 228 - 229, Replace the incorrect ISO code 'kh' in the language switch with the correct ISO 639-1 code 'km': update the case labels that currently read 'kh' and 'khmer' so the primary case is 'km' (keep 'kh' as an additional case label only if you need backward-compatible aliasing), and ensure any downstream references in the same switch or method that rely on that case (the Khmer handling branch) still operate unchanged.
🧹 Nitpick comments (2)
lib/src/models/language.dart (1)
343-345: Consider adding'yi'as an alias for Yiddish.The ISO 639-1 code for Yiddish is
'yi', while'yid'is the ISO 639-2/3 code. For consistency with other languages that accept both formats, consider adding'yi'as an accepted alias:♻️ Proposed change
+ case 'yi': case 'yid': case 'yiddish': return Language.yiddish;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/src/models/language.dart` around lines 343 - 345, Add the ISO 639-1 alias 'yi' to the language mapping so the parser recognizes Yiddish by both codes; update the switch/case handling that currently matches 'yid' and 'yiddish' (the branch that returns Language.yiddish) to also include case 'yi' so calls that pass 'yi' will return Language.yiddish.lib/src/aho_corasick.dart (1)
57-57: Pre-existing inconsistency:runesvscodeUnitsfor character iteration.This is not introduced by this PR, but worth noting:
addWorduses.runes(full Unicode code points) whilesearchuses.codeUnits(UTF-16 code units). For characters outside the Basic Multilingual Plane (e.g., emoji, some CJK characters), this mismatch could cause patterns to not match correctly.Consider aligning both to use
runesfor consistent Unicode handling in a future PR.Also applies to: 132-132
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/src/aho_corasick.dart` at line 57, The code inconsistently iterates characters using .runes in addWord but .codeUnits in search; update the search routine to iterate using runes (e.g., replace uses of codeUnits from word.toLowerCase().codeUnits with runes so both addWord and search use full Unicode code points) and ensure any variables (like codeUnits) are renamed/typed appropriately to reflect rune lists and that comparisons/trie traversal in AhoCorasick methods (addWord, search) use the same int sequence representation.
🤖 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 `@lib/src/models/language.dart`:
- Around line 228-229: Replace the incorrect ISO code 'kh' in the language
switch with the correct ISO 639-1 code 'km': update the case labels that
currently read 'kh' and 'khmer' so the primary case is 'km' (keep 'kh' as an
additional case label only if you need backward-compatible aliasing), and ensure
any downstream references in the same switch or method that rely on that case
(the Khmer handling branch) still operate unchanged.
---
Nitpick comments:
In `@lib/src/aho_corasick.dart`:
- Line 57: The code inconsistently iterates characters using .runes in addWord
but .codeUnits in search; update the search routine to iterate using runes
(e.g., replace uses of codeUnits from word.toLowerCase().codeUnits with runes so
both addWord and search use full Unicode code points) and ensure any variables
(like codeUnits) are renamed/typed appropriately to reflect rune lists and that
comparisons/trie traversal in AhoCorasick methods (addWord, search) use the same
int sequence representation.
In `@lib/src/models/language.dart`:
- Around line 343-345: Add the ISO 639-1 alias 'yi' to the language mapping so
the parser recognizes Yiddish by both codes; update the switch/case handling
that currently matches 'yid' and 'yiddish' (the branch that returns
Language.yiddish) to also include case 'yi' so calls that pass 'yi' will return
Language.yiddish.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2b670e90-8e56-4509-85f3-7063e3876227
📒 Files selected for processing (3)
lib/safe_text.dartlib/src/aho_corasick.dartlib/src/models/language.dart
|
@KirthiSaiT Can you please update the description to point this PR to #17 and not to #28 . Rest everything is good to merge. |
|
@master-wayne7 yes changed the closes #28 to closes #17 |
| TrieNode? current = _root; | ||
| final textLower = text.toLowerCase(); | ||
| final units = textLower.codeUnits; | ||
| final units = textLower.runes.toList(); |
There was a problem hiding this comment.
@KirthiSaiT can you create a separate PR for this? Since its a separate issue we should create a separate PR for that
There was a problem hiding this comment.
@KirthiSaiT I am still able to see that commit in this PR please revert it. Also in your new PR do add the test cases wrt to the change you made. For example, verify if the search is working if you have given a foul emoji(check the end lines of en.txt in assets you'll find them) in the input.
There was a problem hiding this comment.
@KirthiSaiT please remove the above change from this PR so we can merge the documentation and push out a new version.
docs: improve API reference coverage for pub.dev
Description:
Closes #17
What changed
Added
///Dart doc comments to all public symbols so pub.dev generates a complete API reference.Files updated
lib/src/safe_text_filter.dart— class,init,filterText,containsBadWord,normalizeTextlib/src/aho_corasick.dart—TrieNodefields,AhoCorasick,addWord,buildFailureLinks,searchlib/src/models/language.dart—Languageenum,LanguageExtension,fromString,fileCodelib/src/phone_number_checker.dart— class,numberWords,multiplierWords,containsPhoneNumberlib/safe_text.dart— deprecatedSafeTextclass with migration tableStyle
Follows the existing style in
mask_strategy.dart—[paramName]cross-references, fenced dart codeexamples, bullet parameter lists.
Summary by CodeRabbit
Documentation
New Features
Deprecations