@iobroker/repochecker 5.20.2 → 5.20.4

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,14 @@ Example:
31
31
  Placeholder for the next version (at the beginning of the line):
32
32
  ### **WORK IN PROGRESS**
33
33
  -->
34
+ ### 5.20.4 (2026-08-08)
35
+
36
+ * (mcm1957) Fixed `[E6012]`/`[E6013]` not being raised when direct install commands (e.g. `npm install` or `cd /opt/iobroker`) are placed inside fenced code blocks in README.md.
37
+
38
+ ### 5.20.3 (2026-08-07)
39
+
40
+ * (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.
41
+
34
42
  ### 5.20.2 (2026-08-07)
35
43
 
36
44
  * (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
  }
@@ -240,18 +240,21 @@ function stripMarkdownForLanguageDetection(text) {
240
240
 
241
241
  /**
242
242
  * Strip markdown inline formatting for install-instruction text scanning.
243
- * Removes fenced/inline code blocks, expands links to "text URL" so that URL
244
- * checks still work, and removes bold/italic emphasis markers so that formatted
245
- * text like `install from **[GitHub](url)**` is still detected.
243
+ * Keeps the content of fenced/inline code (install commands like `npm install`
244
+ * or `cd /opt/iobroker` are normally placed inside ``` fences and must still be
245
+ * detected), expands links to "text URL" so that URL checks still work, and
246
+ * removes bold/italic emphasis markers so that formatted text like
247
+ * `install from **[GitHub](url)**` is still detected.
246
248
  *
247
249
  * @param {string} text - Raw markdown text
248
250
  * @returns {string} Text with inline formatting stripped
249
251
  */
250
252
  function stripMarkdownInlineFormatting(text) {
251
- // Remove fenced code blocks (``` ... ```)
252
- text = text.replace(/```[\s\S]*?```/g, '');
253
- // Remove inline code (`...`)
254
- text = text.replace(/`[^`\n]*`/g, '');
253
+ // Remove fenced code block delimiter lines (``` and ```lang) but KEEP the
254
+ // enclosed content so shell install commands remain scannable.
255
+ text = text.replace(/^[ \t]*```[^\n]*$/gm, '');
256
+ // Remove inline code backticks but keep the content
257
+ text = text.replace(/`/g, '');
255
258
  // Expand links [text](url) -> "text url" (preserve both visible text and URL for checks)
256
259
  text = text.replace(/\[([^\]]*)\]\(([^)]*)\)/g, '$1 $2');
257
260
  // Remove bold+italic (***) and bold (**) markers
@@ -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.4",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.20.0",
@@ -15,7 +15,7 @@
15
15
  "@alcalzone/release-script": "^5.2.1",
16
16
  "@iobroker/eslint-config": "^2.3.4",
17
17
  "@tsconfig/node20": "^20.1.9",
18
- "@types/node": "^22.19.17",
18
+ "@types/node": "^26.1.2",
19
19
  "@types/semver": "^7.7.1"
20
20
  },
21
21
  "repository": {