Skip E9007/W9008 tracked-but-gitignored check in --local mode (false positives) - #1080
Draft
krobipd wants to merge 1 commit into
Draft
Skip E9007/W9008 tracked-but-gitignored check in --local mode (false positives)#1080krobipd wants to merge 1 commit into
krobipd wants to merge 1 commit into
Conversation
…mode In --local mode context.filesList comes from getAllFiles (M5000_Code.js), a plain filesystem walk that includes gitignored-but-untracked build outputs (e.g. admin/custom, src-admin/build). findIgnoredTrackedEntries then reports them as "tracked but gitignored" — a false positive; their presence on disk is not proof of git-tracking. Guard the loop with !common.isLocal() so the check runs only in remote mode, where filesList is the authoritative committed tree (jsdelivr / GitHub). Real tracked+ignored files are still caught there. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running the checker with
--localreports [W9008] (and can report [E9007]) for files that are not actually tracked by git — a false positive.In
--localmode,context.filesListis built bygetAllFiles(lib/M5000_Code.js), a plain filesystem walk of the working directory. That walk includes gitignored-but-untracked build outputs (admin/custom,src-admin/build, …).findIgnoredTrackedEntriesinM9000_GitNpmIgnore.jsthen matches those against.gitignoreand flags them as "tracked but covered by .gitignore" — but their mere presence on disk is not proof of git-tracking.In remote mode this is correct, because there
filesListis the authoritative committed file tree (fetched from jsdelivr / the GitHub tree).Fix
Guard the
findIgnoredTrackedEntriesloop with!common.isLocal(), matching the!isLocal()guard pattern already used in the codebase (e.g.lib/common.js:251). The E9007/W9008 check now runs only in remote mode, where the file list is authoritative; a genuinely tracked-and-gitignored file is still caught on the CI/remote run. (Also uncomments the already-presentrequire('./common.js').)Verification
Ran the patched checker with
--local --noinfoagainst a real adapter (iobroker.govee-smart, which has gitignoredadmin/custom+src-admin/build): the previous W9008/E9007 false positives drop to 0, all other findings unchanged. Remote-mode behaviour is untouched.Related to #1075 (same class of issue: a check not accounting for
--localmode).