Repository navigation
feat(tools): import as autoconfig and skip what Codacy's defaults cover OD-1406 - #74
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 75 |
| Duplication | 0 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
A high-severity logic defect causes patterns containing brace alternatives to be incorrectly skipped when only one branch matches a Codacy default. This can prevent uncovered ignore rules from being sent to the API.
Codacy also found:
- Complexity warnings in
src/utils/import-ignore-rules.tsforplanIgnoreRulesandprintIgnoreRulesOutcome.
Test suggestions
- Autoconfig imports send source autoconfig and reason Auto-configuration.
- Invalid sources and source usage without import are rejected.
- Default-covered patterns are detected across representative folder, filename, glob, and negation patterns.
- Default-covered patterns are omitted from the planned rules while uncovered patterns remain.
- The source and reason are included on every rule in every API batch.
- The reported default-covered count is included alongside added, existing, and skipped rule results.
TIP How was this review? Give us feedback
| return segments.slice(0, -1).some((segment) => { | ||
| const folder = literalOf(segment); | ||
| return folder !== undefined && DEFAULT_IGNORED_FOLDERS.some((f) => folder.endsWith(f)); |
There was a problem hiding this comment.
🔴 HIGH RISK
A pattern such as {foo/vendor/**,src/**} is skipped even though its src/** branch is not covered by the defaults. The folder check sees vendor without accounting for the enclosing brace alternative. Consider expanding alternatives before checking coverage, or conservatively retaining patterns with cross-segment alternatives.
TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.
|
Tested. Please merge! |
Stacked on #73.
The auto-configuration skill imports its paths with
tools --import, but every rule was recorded as added by a person. The import also added the Codacy defaults thatinit --autowrites intoexcludeas duplicate rules, because defaults aren't stored. OD-1406--source autoconfigrecords the rules with sourceautoconfigand reason "Auto-configuration". Without it nothing changes.Patterns that Codacy's defaults already cover aren't sent, and are counted in one line. The check is on what a pattern matches, since
init --autowrites the defaults as ordinary globs. The lists mirror foundation'sCodacyDefaultIgnores.Test on dev:
init --auto, thentools --import .codacy/auto.config.json --source autoconfig