@iobroker/repochecker 5.20.2 → 5.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,6 +31,10 @@ Example:
31
31
  Placeholder for the next version (at the beginning of the line):
32
32
  ### **WORK IN PROGRESS**
33
33
  -->
34
+ ### 5.20.3 (2026-08-07)
35
+
36
+ * (mcm1957) Fixed false positive `[S9508]` (and related packaging/i18n checks): negation entries (e.g. `!CHANGELOG_OLD.md`) in package.json `"files"` are now handled as exclusions instead of being wrongly matched. Related to #1097 and #1072.
37
+
34
38
  ### 5.20.2 (2026-08-07)
35
39
 
36
40
  * (mcm1957) React usage is now also detected when `@iobroker/gui-components` is used as dependency.
package/index.js CHANGED
@@ -343,6 +343,14 @@ if (typeof module !== 'undefined' && module.parent) {
343
343
  }
344
344
  console.log(`\ncreated by repochecker ${context.version} based on commit ${context.lastCommitSha}`);
345
345
 
346
+ if (common.isLocal()) {
347
+ console.log(`\n----------------------------------------------------------`);
348
+ console.log(`This check has been run using --local mode.`);
349
+ console.log(`Please note that local mode is experimental state only and`);
350
+ console.log(`may report false positive findings and miss real issues.`);
351
+ console.log(`----------------------------------------------------------`);
352
+ }
353
+
346
354
  if (common.isLocal() && context.errors.length) {
347
355
  process.exit(1);
348
356
  }
@@ -222,15 +222,29 @@ function isGlobPattern(entry) {
222
222
  * @returns {boolean} true if the file is included
223
223
  */
224
224
  function isFileIncludedInFiles(filePath, filesEntries) {
225
- return filesEntries.some(entry => {
226
- const normalized = entry.replace(/^\.?\//, '').replace(/\/+$/, '');
227
-
228
- if (isGlobPattern(entry)) {
229
- return minimatch(filePath, normalized, { dot: true });
225
+ // Process entries in order so that a later negation (e.g. "!CHANGELOG_OLD.md")
226
+ // can exclude a file that an earlier entry (e.g. "*.md") included.
227
+ let included = false;
228
+ for (const entry of filesEntries) {
229
+ // A leading "!" marks an exclusion; strip it and remember it separately
230
+ // instead of passing it to minimatch (which would treat "!" as its own
231
+ // negation operator and wrongly match unrelated files).
232
+ const isNegation = entry.startsWith('!');
233
+ const pattern = isNegation ? entry.slice(1) : entry;
234
+ const normalized = pattern.replace(/^\.?\//, '').replace(/\/+$/, '');
235
+
236
+ let matches;
237
+ if (isGlobPattern(pattern)) {
238
+ matches = minimatch(filePath, normalized, { dot: true });
239
+ } else {
240
+ matches = normalized === '.' || normalized === filePath || filePath.startsWith(`${normalized}/`);
230
241
  }
231
242
 
232
- return normalized === '.' || normalized === filePath || filePath.startsWith(`${normalized}/`);
233
- });
243
+ if (matches) {
244
+ included = !isNegation;
245
+ }
246
+ }
247
+ return included;
234
248
  }
235
249
 
236
250
  /**
@@ -252,17 +266,31 @@ function isI18nDirIncludedInFiles(i18nDir, filesEntries, allFiles) {
252
266
  })
253
267
  .map(f => f.replace(/^\//, ''));
254
268
 
255
- return filesEntries.some(entry => {
256
- const normalized = entry.replace(/^\.\//, '').replace(/\/+$/, '');
257
-
258
- if (isGlobPattern(entry)) {
269
+ // Process entries in order so that a later negation (e.g. "!admin/i18n/**")
270
+ // can exclude a directory that an earlier entry included.
271
+ let included = false;
272
+ for (const entry of filesEntries) {
273
+ // A leading "!" marks an exclusion; strip it and remember it separately
274
+ // instead of passing it to minimatch (which would treat "!" as its own
275
+ // negation operator and wrongly match unrelated files).
276
+ const isNegation = entry.startsWith('!');
277
+ const pattern = isNegation ? entry.slice(1) : entry;
278
+ const normalized = pattern.replace(/^\.\//, '').replace(/\/+$/, '');
279
+
280
+ let matches;
281
+ if (isGlobPattern(pattern)) {
259
282
  // Use minimatch to test whether any file inside the i18n directory matches the glob
260
- return i18nFiles.some(file => minimatch(file, entry, { dot: true }));
283
+ matches = i18nFiles.some(file => minimatch(file, normalized, { dot: true }));
284
+ } else {
285
+ // Plain path: covered if entry is exactly the i18n dir, a parent dir, or '.' (root)
286
+ matches = normalized === '.' || normalized === i18nPath || i18nPath.startsWith(`${normalized}/`);
261
287
  }
262
288
 
263
- // Plain path: covered if entry is exactly the i18n dir, a parent dir, or '.' (root)
264
- return normalized === '.' || normalized === i18nPath || i18nPath.startsWith(`${normalized}/`);
265
- });
289
+ if (matches) {
290
+ included = !isNegation;
291
+ }
292
+ }
293
+ return included;
266
294
  }
267
295
 
268
296
  /**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.20.2",
2
+ "version": "5.20.3",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.20.0",