@iobroker/repochecker 5.18.3 → 5.18.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
@@ -25,6 +25,15 @@ Example:
25
25
  Placeholder for the next version (at the beginning of the line):
26
26
  ### **WORK IN PROGRESS**
27
27
  -->
28
+ ### 5.18.4 (2026-06-09)
29
+
30
+ - (mcm1957) build directory excluded from I18n scans
31
+ - (mcm1957) Handling of alpha releasea at changelog corrected
32
+ - (mcm1957) Changing text for missing updates limited to 50 days
33
+ - (mcm1957) Encrypted / protected UI data depuplicated
34
+ - (mcm1957) Scanning for sourcefiles and imports corrected
35
+ - (mcm1957) Special filtering added
36
+
28
37
  ### 5.18.3 (2026-06-06)
29
38
 
30
39
  - (mcm1957) Support for objectStructure check added
@@ -569,10 +569,11 @@ async function checkNpmDependencyUpdateSuggestions(context) {
569
569
  return;
570
570
  }
571
571
 
572
- const dayLabel = packageAgeDays === 1 ? 'day' : 'days';
573
572
  const issueCode = updateRule.level === 'W' ? 'W0083' : 'S0082';
573
+ const ageThreshold = Math.floor(packageAgeDays / 50) * 50;
574
+ const ageInfo = ageThreshold >= 50 ? ` The newer version has been published for more than ${ageThreshold} days.` : '';
574
575
  context.warnings.push(
575
- `[${issueCode}] A newer version (${latestVersion}) for package "${packageName}" (${sourceType}) exists for ${packageAgeDays} ${dayLabel}. Please evaluate if upgrading from ${packageVersion} to ${latestVersion} is possible.`,
576
+ `[${issueCode}] A newer version (${latestVersion}) for package "${packageName}" (${sourceType}) exists.${ageInfo} Please evaluate if upgrading from ${packageVersion} to ${latestVersion} is possible.`,
576
577
  );
577
578
  } catch (e) {
578
579
  common.debug(
@@ -388,35 +388,27 @@ async function checkIOPackageJson(context) {
388
388
  common.debug(`Suspicious key test: suspiciousKeys (filtered): ${suspiciousKeys}`);
389
389
  }
390
390
  if (suspiciousKeys.length) {
391
- if (context.ioPackageJson.protectedNative) {
392
- const missingProtected = suspiciousKeys.filter(
393
- key =>
394
- !(context.ioPackageJson.protectedNative && context.ioPackageJson.protectedNative.includes(key)),
395
- );
396
- if (missingProtected.length) {
397
- context.warnings.push(
398
- `[W1073] Potential sensitive data "${missingProtected.join()}" not listed at "protectedNative" in io-package.json`,
399
- );
400
- }
401
- } else {
391
+ const missingProtected = context.ioPackageJson.protectedNative
392
+ ? suspiciousKeys.filter(
393
+ key => !context.ioPackageJson.protectedNative.includes(key),
394
+ )
395
+ : [...suspiciousKeys];
396
+ context.reportedMissingProtectedNativeKeys = missingProtected;
397
+ if (missingProtected.length) {
402
398
  context.warnings.push(
403
- `[W1073] Potential sensitive data "${suspiciousKeys.join()}" not listed at "protectedNative" in io-package.json`,
399
+ `[W1073] Potential sensitive data "${missingProtected.join()}" not listed at "protectedNative" in io-package.json`,
404
400
  );
405
401
  }
406
402
 
407
- if (context.ioPackageJson.encryptedNative) {
408
- const missingProtected = suspiciousKeys.filter(
409
- key =>
410
- !(context.ioPackageJson.encryptedNative && context.ioPackageJson.encryptedNative.includes(key)),
411
- );
412
- if (missingProtected.length) {
413
- context.warnings.push(
414
- `[W1074] Potential sensitive data "${missingProtected.join(', ')}" not listed at "encryptedNative" in io-package.json`,
415
- );
416
- }
417
- } else {
403
+ const missingEncrypted = context.ioPackageJson.encryptedNative
404
+ ? suspiciousKeys.filter(
405
+ key => !context.ioPackageJson.encryptedNative.includes(key),
406
+ )
407
+ : [...suspiciousKeys];
408
+ context.reportedMissingEncryptedNativeKeys = missingEncrypted;
409
+ if (missingEncrypted.length) {
418
410
  context.warnings.push(
419
- `[W1074] Potential sensitive data "${suspiciousKeys.join(', ')}" not listed at "encryptedNative" in io-package.json`,
411
+ `[W1074] Potential sensitive data "${missingEncrypted.join(', ')}" not listed at "encryptedNative" in io-package.json`,
420
412
  );
421
413
  }
422
414
  }
package/lib/M5000_Code.js CHANGED
@@ -1203,6 +1203,12 @@ async function checkCode(context) {
1203
1203
  const encryptedNative = new Set(
1204
1204
  Array.isArray(context.ioPackageJson.encryptedNative) ? context.ioPackageJson.encryptedNative : [],
1205
1205
  );
1206
+ const reportedProtectedKeys = new Set(
1207
+ Array.isArray(context.reportedMissingProtectedNativeKeys) ? context.reportedMissingProtectedNativeKeys : [],
1208
+ );
1209
+ const reportedEncryptedKeys = new Set(
1210
+ Array.isArray(context.reportedMissingEncryptedNativeKeys) ? context.reportedMissingEncryptedNativeKeys : [],
1211
+ );
1206
1212
  const passwordLocations = new Map();
1207
1213
 
1208
1214
  for (const adminFile of context.filesList) {
@@ -1225,19 +1231,28 @@ async function checkCode(context) {
1225
1231
  }
1226
1232
  }
1227
1233
 
1228
- for (const [nativeKey, locations] of passwordLocations.entries()) {
1229
- const locationList = [...locations].join(', ');
1230
- if (!protectedNative.has(nativeKey)) {
1231
- context.warnings.push(
1232
- `[W5057] jsonConfig password field "${nativeKey}" (${locationList}) is not listed at "protectedNative" in io-package.json`,
1233
- );
1234
+ const missingProtected = [];
1235
+ const missingEncrypted = [];
1236
+
1237
+ for (const [nativeKey] of passwordLocations.entries()) {
1238
+ if (!protectedNative.has(nativeKey) && !reportedProtectedKeys.has(nativeKey)) {
1239
+ missingProtected.push(nativeKey);
1234
1240
  }
1235
- if (!encryptedNative.has(nativeKey)) {
1236
- context.warnings.push(
1237
- `[W5058] jsonConfig password field "${nativeKey}" (${locationList}) is not listed at "encryptedNative" in io-package.json`,
1238
- );
1241
+ if (!encryptedNative.has(nativeKey) && !reportedEncryptedKeys.has(nativeKey)) {
1242
+ missingEncrypted.push(nativeKey);
1239
1243
  }
1240
1244
  }
1245
+
1246
+ if (missingProtected.length) {
1247
+ context.warnings.push(
1248
+ `[W5057] jsonConfig password field(s) "${missingProtected.join(', ')}" is not listed at "protectedNative" in io-package.json`,
1249
+ );
1250
+ }
1251
+ if (missingEncrypted.length) {
1252
+ context.warnings.push(
1253
+ `[W5058] jsonConfig password field(s) "${missingEncrypted.join(', ')}" is not listed at "encryptedNative" in io-package.json`,
1254
+ );
1255
+ }
1241
1256
  }
1242
1257
 
1243
1258
  // Check for table/accordion components with encryptedAttributes requiring js-controller >= 7.0.7
@@ -1779,29 +1794,44 @@ async function checkCode(context) {
1779
1794
  // Exclude files in admin/, build/, doc/, docs/, src-admin/, admin-src/, test/ directories
1780
1795
  // and *.test.* and *.config.* files
1781
1796
  const sourceFileExtensions = new Set(['.js', '.mjs', '.cjs', '.ts']);
1797
+ // '/path' entries match repository root directories only, while entries without '/'
1798
+ // match directory names at any level in the repository tree.
1782
1799
  const excludedSourceDirs = new Set([
1783
- 'admin',
1784
- 'build',
1785
- 'doc',
1786
- 'docs',
1787
- 'scripts',
1788
- 'template',
1789
- 'templates',
1790
- 'src-admin',
1791
- 'src-editor', // java-script adapter
1792
- 'src-rules',
1793
- 'src-widgets',
1794
- 'www',
1795
- 'widgets',
1796
- 'admin-src',
1797
- 'rules-src',
1798
- 'test',
1799
- 'node_modules',
1800
- '.git',
1801
- '.vscode',
1802
- '.dev-server',
1803
- 'hass_frontend', // special for ioBroker.hass
1800
+ '/admin',
1801
+ '/build',
1802
+ '/doc',
1803
+ '/docs',
1804
+ '/scripts',
1805
+ '/template',
1806
+ '/templates',
1807
+ '/src-admin',
1808
+ '/src-editor', // java-script adapter
1809
+ '/src-rules',
1810
+ '/src-widgets',
1811
+ '/www',
1812
+ '/widgets',
1813
+ '/admin-src',
1814
+ '/rules-src',
1815
+ '/test',
1816
+ '/node_modules',
1817
+ '/.git',
1818
+ '/.vscode',
1819
+ '/.dev-server',
1820
+ '/hass_frontend', // special for ioBroker.hass
1821
+ 'tmp',
1804
1822
  ]);
1823
+ const excludedSourceRootDirNames = new Set();
1824
+ const excludedSourceAnyLevelDirs = new Set();
1825
+ for (const excludedSourceDir of excludedSourceDirs) {
1826
+ if (excludedSourceDir.startsWith('/')) {
1827
+ const rootDirName = excludedSourceDir.slice(1);
1828
+ if (rootDirName) {
1829
+ excludedSourceRootDirNames.add(rootDirName);
1830
+ }
1831
+ } else {
1832
+ excludedSourceAnyLevelDirs.add(excludedSourceDir);
1833
+ }
1834
+ }
1805
1835
  // Exact file base names to exclude from scanning
1806
1836
  const excludedSourceFiles = new Set(['tasks.js', 'tasks.ts', 'Gruntfile.js', 'gulpfile.js']);
1807
1837
 
@@ -1856,7 +1886,10 @@ async function checkCode(context) {
1856
1886
 
1857
1887
  // Skip files in excluded directories
1858
1888
  const pathParts = filePath.split('/').filter(p => p !== '');
1859
- if (pathParts.some(p => excludedSourceDirs.has(p))) {
1889
+ const isInExcludedSourceRootDir = pathParts.length > 0 && excludedSourceRootDirNames.has(pathParts[0]);
1890
+ const isInExcludedSourceAnyLevelDir = pathParts.some(pathPart => excludedSourceAnyLevelDirs.has(pathPart));
1891
+ const isInExcludedSourceDir = isInExcludedSourceRootDir || isInExcludedSourceAnyLevelDir;
1892
+ if (isInExcludedSourceDir) {
1860
1893
  continue;
1861
1894
  }
1862
1895
 
@@ -2195,8 +2228,8 @@ exports.getFilesList = getFilesList;
2195
2228
  // [W5054] "admin/blockly.js" found but blockly support is not declared in io-package.json. Consider removing the file or setting "common.blockly": true.
2196
2229
  // [W5055] "admin/index.html" found but materialize is used. This file is for admin2 (old UI) and is outdated. Please consider removing it.
2197
2230
  // [W5056] "admin/custom.html" or "admin/custom_m.html" is no longer supported. Please migrate to "admin/jsonCustom.json".
2198
- // [W5057] jsonConfig password field "${nativeKey}" (${locationList}) is not listed at "protectedNative" in io-package.json
2199
- // [W5058] jsonConfig password field "${nativeKey}" (${locationList}) is not listed at "encryptedNative" in io-package.json
2231
+ // [W5057] jsonConfig password field(s) "${nativeKey1, nativeKey2}" is not listed at "protectedNative" in io-package.json
2232
+ // [W5058] jsonConfig password field(s) "${nativeKey1, nativeKey2}" is not listed at "encryptedNative" in io-package.json
2200
2233
  // [W5059] Adapter uses class mode ("class ... extends utils.Adapter") in "${context.packageJson.main}" and also uses "utils.adapter(...)" in source file(s): ${fileList}. Please use only one adapter pattern.
2201
2234
  // [W5060] Package "${dependency}" is listed in dependencies of package.json but not imported or required by any scanned source file. Dependency might be unused.
2202
2235
  // [W5061] "utils.commonTools.letsEncrypt" usage detected. Let's Encrypt support was removed in js-controller 6.
@@ -12,7 +12,14 @@ const JSON5 = require('json5');
12
12
  const common = require('./common.js');
13
13
 
14
14
  // Directories to always exclude when scanning for i18n content
15
- const I18N_EXCLUDED_DIRS = new Set(['node_modules', '.git', '.vscode', '.dev-server']);
15
+ // eslint-disable-next-line prettier/prettier
16
+ const I18N_EXCLUDED_DIRS = new Set([
17
+ 'node_modules',
18
+ '.git',
19
+ '.vscode',
20
+ '.dev-server',
21
+ 'build',
22
+ ]);
16
23
 
17
24
  // Translatable attributes in jsonConfig to scan for proper i18n usage.
18
25
  // Add new attribute names here to extend the list of attributes checked.
@@ -385,7 +385,7 @@ async function checkReadme(context) {
385
385
  context.checks.push('README.md changelog contains "###" entries');
386
386
  const invalidVersionHeaders = [];
387
387
  for (const header of changelogHeaders) {
388
- const match = /^(\d+\.\d+\.\d+)(?:\s+.*)?$/.exec(header);
388
+ const match = /^(\d+\.\d+\.\d+(-\w+\.\d+)?)(?:\s+.*)?$/.exec(header);
389
389
  if (!match) {
390
390
  if (!header.includes('WORK IN PROGRESS') && !header.includes('CHANGELOG_OLD.md')) {
391
391
  invalidVersionHeaders.push(header);
@@ -7,10 +7,34 @@
7
7
 
8
8
  */
9
9
 
10
+ const common = require('./common.js');
11
+
10
12
  // ---------------------------------------------------------------------------
11
13
  // Configuration tables
12
14
  // ---------------------------------------------------------------------------
13
15
 
16
+ /**
17
+ * Per-adapter issue filter table (used by filterIssuesByAdapter).
18
+ *
19
+ * Key : adapter name without the "ioBroker." prefix and without owner,
20
+ * e.g. 'backitup'.
21
+ * Value : array of issue text patterns to suppress for that adapter.
22
+ * Each pattern is matched against the full issue string.
23
+ * The wildcard character '*' may appear anywhere in the pattern
24
+ * and matches any sequence of characters (including the empty string).
25
+ *
26
+ * Example entry:
27
+ * backitup: [
28
+ * '[E5050] process.exit() used in * (lib/restore.js)*',
29
+ * ],
30
+ */
31
+ const filterByAdapter = {
32
+ // eslint-disable-next-line prettier/prettier
33
+ backitup: [
34
+ '[E5050] process.exit() used in * (lib/restore.js)*',
35
+ ],
36
+ };
37
+
14
38
  /**
15
39
  * Severity remapping table for new adapters (used by adaptSeverity4New).
16
40
  *
@@ -41,7 +65,7 @@ const mapSeverity4New = {
41
65
  W5018: 'E', // [W5018] "@alcalzone/release-script" (>=3.0.0) is used, but ".releaseconfig.json" not found. Please create.',
42
66
  W5512: 'E', // [W5512] admin/jsonConfig.json schema validation error: ...
43
67
  W5612: 'E', // W5612] "admin/jsonConfig.json/items/..." attribute "label" uses key "..." which is not found in the English translation file at "admin/i18n/en".
44
- W6020: 'E', // [W6020] Consider adding a CHANGELOG_OLD.md file to store older changelog entries.
68
+ W6020: 'E', // [W6020] Consider adding a CHANGELOG_OLD.md file to store older changelog entries.
45
69
  W6021: 'E', // [W6021] "## License" is not the last section in README.md.
46
70
  W8915: 'E', // [W8915] Dependabot npm entry (directory: "/") has no "cooldown" configured.
47
71
  W8916: 'E', // [W8916] Dependabot configuration "/.github/dependabot.yml" has no entry with "package-ecosystem: github-actions".
@@ -70,6 +94,87 @@ const mapSeverity4New = {
70
94
  // Postprocessing tasks
71
95
  // ---------------------------------------------------------------------------
72
96
 
97
+ /**
98
+ * Tests whether a single issue string matches a filter pattern.
99
+ * The pattern may contain '*' as a wildcard that matches any sequence of
100
+ * characters (including the empty string). All other characters are treated
101
+ * as literals.
102
+ *
103
+ * @param {string} issue - The full issue text to test
104
+ * @param {string} pattern - The pattern, optionally containing '*' wildcards
105
+ * @returns {boolean} true if the issue matches the pattern
106
+ */
107
+ function matchesPattern(issue, pattern) {
108
+ // Split on '*' so each segment can be escaped independently, then
109
+ // rejoin with '.*' to form a full-match regular expression.
110
+ const segments = pattern.split('*');
111
+ const regexStr = segments.map(s => s.replace(/[.+?^${}()|[\]\\]/g, '\\$&')).join('.*');
112
+ const regex = new RegExp('^' + regexStr + '$');
113
+ return regex.test(issue);
114
+ }
115
+
116
+ /**
117
+ * Removes issues from context.errors and context.warnings that match any
118
+ * filter pattern defined for the current adapter in filterByAdapter.
119
+ *
120
+ * If context.adapterName is not set, or no entry exists for that adapter
121
+ * in filterByAdapter, the function returns immediately without changes.
122
+ *
123
+ * For every removed issue an info message is logged via common.info().
124
+ * If at least one issue was removed a summary suggestion
125
+ * "[S0000] Info: ### issues ignored for this adapter." is appended to
126
+ * context.warnings (where ### is the count of removed issues).
127
+ *
128
+ * @param {object} context - The checker context
129
+ * @returns {object} The (possibly modified) context
130
+ */
131
+ function filterIssuesByAdapter(context) {
132
+ const adapterName = context.adapterName;
133
+ if (!adapterName) {
134
+ return context;
135
+ }
136
+
137
+ const patterns = filterByAdapter[adapterName];
138
+ if (!patterns || patterns.length === 0) {
139
+ return context;
140
+ }
141
+
142
+ let removedCount = 0;
143
+
144
+ /**
145
+ * Scan one issue array in-place and remove entries matching any pattern.
146
+ *
147
+ * @param {string[]} arr - context.errors or context.warnings
148
+ */
149
+ function filterArray(arr) {
150
+ for (let i = arr.length - 1; i >= 0; i--) {
151
+ const issue = arr[i];
152
+ for (const pattern of patterns) {
153
+ if (matchesPattern(issue, pattern)) {
154
+ common.info(
155
+ `[postprocessing] filterIssuesByAdapter: removed issue for adapter "${adapterName}": ${issue}`,
156
+ );
157
+ arr.splice(i, 1);
158
+ removedCount++;
159
+ break; // no need to check further patterns for this issue
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ filterArray(context.errors);
166
+ filterArray(context.warnings);
167
+
168
+ if (removedCount > 0) {
169
+ common.info(
170
+ `[postprocessing] filterIssuesByAdapter: ${removedCount} issue(s) ignored for adapter "${adapterName}".`,
171
+ );
172
+ context.warnings.push(`[S0000] Info: ${removedCount} issue(s) ignored for this adapter.`);
173
+ }
174
+
175
+ return context;
176
+ }
177
+
73
178
  /**
74
179
  * Remaps the severity of issues for new adapters according to mapSeverity4New.
75
180
  *
@@ -159,6 +264,7 @@ function postprocessing(context) {
159
264
  console.log('\n[postprocessing] running postprocessing tasks');
160
265
 
161
266
  adaptSeverity4New(context);
267
+ filterIssuesByAdapter(context);
162
268
 
163
269
  return context;
164
270
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.18.3",
2
+ "version": "5.18.4",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.20.0",