Skip to content

Skip E9007/W9008 tracked-but-gitignored check in --local mode (false positives) - #1080

Draft
krobipd wants to merge 1 commit into
ioBroker:masterfrom
krobipd:fix/w9008-e9007-local-mode-false-positive
Draft

Skip E9007/W9008 tracked-but-gitignored check in --local mode (false positives)#1080
krobipd wants to merge 1 commit into
ioBroker:masterfrom
krobipd:fix/w9008-e9007-local-mode-false-positive

Conversation

@krobipd

@krobipd krobipd commented Jul 23, 2026

Copy link
Copy Markdown

Problem

Running the checker with --local reports [W9008] (and can report [E9007]) for files that are not actually tracked by git — a false positive.

In --local mode, context.filesList is built by getAllFiles (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, …). findIgnoredTrackedEntries in M9000_GitNpmIgnore.js then matches those against .gitignore and 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 filesList is the authoritative committed file tree (fetched from jsdelivr / the GitHub tree).

Fix

Guard the findIgnoredTrackedEntries loop 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-present require('./common.js').)

Verification

Ran the patched checker with --local --noinfo against a real adapter (iobroker.govee-smart, which has gitignored admin/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 --local mode).

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant