@iobroker/repochecker 5.6.9 → 5.7.1

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,16 @@ Example:
25
25
  Placeholder for the next version (at the beginning of the line):
26
26
  ### **WORK IN PROGRESS**
27
27
  -->
28
+ ### 5.7.1 (2026-04-07)
29
+ - (mcm1957) Improve jsonConfig schema validation messages.
30
+
31
+ ### 5.7.0 (2026-04-06)
32
+ - (@copilot) [S8913] automerge suggestion is no longer shown when dependabot is not configured ([S8901]).
33
+ - (@copilot) Language detection: `GERMAN_WORDS` and `ENGLISH_WORDS` arrays sorted alphabetically; chapters titled "Haftungsausschluss" in README.md are now ignored when checking for German text.
34
+ - (@copilot) Added JSON5 support for `jsonTab.json5`: `admin/jsonTab.json` and `admin/jsonTab.json5` are now read and parsed; E5044 is raised for parse errors and E5045 when the file is missing but tab support is declared. [#780]
35
+ - (@copilot) Fixed false-positive W4042/W4044 warnings for adapters using only `jsonConfig.json5`: the VS Code schema checks now detect which config files actually exist in the repository and use `some()` instead of `every()` to match schema entries, preventing false warnings when a valid json5-only schema is configured. [#780]
36
+ - (@copilot) Added schema validation for all present jsonConfig files (`admin/jsonConfig.json`, `admin/jsonCustom.json`, `admin/jsonTab.json` and their `.json5` variants) against the official jsonConfig JSON schema; errors reported as E5512, schema download failures as W5513, and exceptions as E5514. [#803]
37
+
28
38
  ### 5.6.9 (2026-04-02)
29
39
  - (mcm1957) Ignore "widgets" directory when scanning for imported packages.
30
40
 
@@ -204,7 +204,7 @@ async function checkTests(context) {
204
204
  `Must include "*" or the default branch ("${context.branch}").`,
205
205
  );
206
206
  } else {
207
- const defaultBranch = context.branch || 'main';
207
+ const defaultBranch = context.branch || 'unknown';
208
208
  const hasWildcard = branches.includes('*');
209
209
  const hasDefaultBranch = branches.includes(defaultBranch);
210
210
  if (!hasWildcard && !hasDefaultBranch) {
@@ -423,7 +423,7 @@ async function checkVSCodeSchemas(context) {
423
423
  const jsonConfigFiles = ['admin/jsonConfig.json', 'admin/jsonCustom.json', 'admin/jsonTab.json'];
424
424
  const json5ConfigFiles = ['admin/jsonConfig.json5', 'admin/jsonCustom.json5', 'admin/jsonTab.json5'];
425
425
 
426
- // Find schema that matches jsonConfig files
426
+ // Find schema that matches any present jsonConfig files
427
427
  const jsonConfigSchema = schemas.find(
428
428
  schema => schema.fileMatch && jsonConfigFiles.every(file => schema.fileMatch.includes(file)),
429
429
  );
package/lib/M5000_Code.js CHANGED
@@ -269,6 +269,8 @@ async function checkCode(context) {
269
269
  '/admin/jsonConfig.json5',
270
270
  '/admin/jsonCustom.json',
271
271
  '/admin/jsonCustom.json5',
272
+ '/admin/jsonTab.json',
273
+ '/admin/jsonTab.json5',
272
274
  '/admin/blockly.js',
273
275
 
274
276
  '/src-admin/package.json', // check if react is used
@@ -755,6 +757,53 @@ async function checkCode(context) {
755
757
  }
756
758
  }
757
759
 
760
+ if (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.tab === 'json') {
761
+ if (context['/admin/jsonTab.json'] || context['/admin/jsonTab.json5']) {
762
+ try {
763
+ context['/admin/jsonTab.json']
764
+ ? JSON.parse(context['/admin/jsonTab.json'])
765
+ : JSON5.parse(context['/admin/jsonTab.json5']);
766
+ } catch (e) {
767
+ context.errors.push(
768
+ `[E5044] Cannot parse "/admin/jsonTab.json${context['/admin/jsonTab.json'] ? '' : '5'}": ${e}`,
769
+ );
770
+ }
771
+ } else {
772
+ context.errors.push(
773
+ `[E5045] "/admin/jsonTab.json${context['/admin/jsonTab.json'] ? '' : '5'}" not found, but tab support is declared`,
774
+ );
775
+ }
776
+ }
777
+
778
+ // Validate all present jsonConfig files against the jsonConfig schema
779
+ const jsonConfigFilesToValidate = [
780
+ '/admin/jsonConfig.json',
781
+ '/admin/jsonCustom.json',
782
+ '/admin/jsonTab.json',
783
+ '/admin/jsonConfig.json5',
784
+ '/admin/jsonCustom.json5',
785
+ '/admin/jsonTab.json5',
786
+ ];
787
+
788
+ for (const configFile of jsonConfigFilesToValidate) {
789
+ if (context[configFile]) {
790
+ let parsed;
791
+ try {
792
+ parsed = configFile.endsWith('.json5')
793
+ ? JSON5.parse(context[configFile])
794
+ : JSON.parse(context[configFile]);
795
+ } catch (e) {
796
+ common.debug(`Could not parse ${configFile} for schema validation: ${e.message}`);
797
+ context.warnings.push(
798
+ `[W5515] Schema validation skipped for "${configFile.replace(/^\//, '')}" due to parse error: ${e.message}`,
799
+ );
800
+ }
801
+ if (parsed) {
802
+ await M5500__jsonConfig.validateJsonConfigSchema(context, configFile.replace(/^\//, ''), parsed);
803
+ }
804
+ }
805
+ }
806
+
758
807
  if (context.ioPackageJson.common.blockly && !context['/admin/blockly.js']) {
759
808
  context.errors.push('[E5014] "/admin/blockly.js" not found, but blockly support is declared');
760
809
  }
@@ -1181,16 +1230,10 @@ async function checkCode(context) {
1181
1230
  '.dev-server',
1182
1231
  ]);
1183
1232
  // Exact file base names to exclude from dependency scanning
1184
- const excludedSourceFiles = new Set([
1185
- 'tasks.js',
1186
- 'Gruntfile.js',
1187
- 'gulpfile.js'
1188
- ]);
1233
+ const excludedSourceFiles = new Set(['tasks.js', 'Gruntfile.js', 'gulpfile.js']);
1189
1234
 
1190
1235
  // Exact relative file paths (without leading slash) to exclude from dependency scanning
1191
- const excludedSourceRelPaths = new Set([
1192
- 'lib/tools.js'
1193
- ]);
1236
+ const excludedSourceRelPaths = new Set(['lib/tools.js']);
1194
1237
 
1195
1238
  const packageDependencies = context.packageJson.dependencies || {};
1196
1239
  const packageDevDependencies = context.packageJson.devDependencies || {};
@@ -1239,20 +1282,24 @@ async function checkCode(context) {
1239
1282
 
1240
1283
  // Skip relative paths (./xxx, ../xxx) and absolute paths (/xxx)
1241
1284
  // Skip dynamic generated strings (`${xxx}`) and debug vars
1242
- if (importTarget.startsWith('.') ||
1285
+ if (
1286
+ importTarget.startsWith('.') ||
1243
1287
  importTarget.startsWith('/') ||
1244
1288
  importTarget.includes('~') || // '~debug~xx'
1245
1289
  importTarget.includes('$') || // `${myvar}/xxx`
1246
1290
  importTarget.includes('{') ||
1247
- importTarget.includes('}')) {
1291
+ importTarget.includes('}')
1292
+ ) {
1248
1293
  continue;
1249
1294
  }
1250
1295
 
1251
1296
  // Skip obvious filenames
1252
- if (importTarget.endsWith('.js') ||
1297
+ if (
1298
+ importTarget.endsWith('.js') ||
1253
1299
  importTarget.endsWith('.mjs') ||
1254
1300
  importTarget.endsWith('.cjs') ||
1255
- importTarget.endsWith('.ts')) {
1301
+ importTarget.endsWith('.ts')
1302
+ ) {
1256
1303
  continue;
1257
1304
  }
1258
1305
 
@@ -1364,5 +1411,8 @@ exports.checkCode = checkCode;
1364
1411
  // [W5041] Example configuration (option1/option2) found in i18n translation files (en, de, ...). Please remove example configuration from your code. (renamed from W1111)
1365
1412
  // [W5042] Package "${packageName}" is used in source files but not found in dependencies of package.json. Dependency might be missing.
1366
1413
  // [S5043] Package "${packageName}" is a built-in Node.js module. Please use "node:${packageName}" prefix instead.
1414
+ // [E5044] Cannot parse "/admin/jsonTab.json[5]": ${e}
1415
+ // [E5045] "/admin/jsonTab.json[5]" not found, but tab support is declared
1416
+ // [W5515] Schema validation skipped for "${configFile}" due to parse error: ${e.message}
1367
1417
 
1368
1418
  // [5500 - ] see M5500_jsonConfig.js
@@ -16,7 +16,10 @@
16
16
 
17
17
  */
18
18
 
19
+ const Ajv = require('ajv');
20
+
19
21
  const common = require('./common.js');
22
+ const config = require('./config.js');
20
23
 
21
24
  let responsiveErrorLimit = 5;
22
25
  let responsiveWarningLimit = 5;
@@ -654,7 +657,85 @@ function checkJsonConfig(context, path, jsonConfig) {
654
657
  return;
655
658
  }
656
659
 
660
+ // Cached compiled AJV validator for jsonConfig schema (downloaded and compiled once per process)
661
+ let cachedJsonConfigValidate = null;
662
+
663
+ async function validateJsonConfigSchema(context, filePath, jsonConfigData) {
664
+ common.debug(`[schema] validating ${filePath} against schema`);
665
+
666
+ try {
667
+ if (!cachedJsonConfigValidate) {
668
+ const schemaUrl = config.schemaUrls.jsonConfig;
669
+ common.debug(`Downloading schema from ${schemaUrl}`);
670
+
671
+ const schemaData = await common.downloadURL(schemaUrl, false);
672
+ if (!schemaData) {
673
+ context.warnings.push(`[W5513] Could not download ${schemaUrl} for validation of ${filePath}`);
674
+ return;
675
+ }
676
+
677
+ const schema = JSON.parse(schemaData);
678
+
679
+ // Initialize AJV validator and cache the compiled schema
680
+ common.debug(`parsing jsonConfig schema ${schemaUrl}`);
681
+ // @ts-expect-error not constructable - but working
682
+ const ajv = new Ajv({ allErrors: true, verbose: true, strictTypes: false, strictSchema: false });
683
+ cachedJsonConfigValidate = ajv.compile(schema);
684
+ }
685
+ } catch (error) {
686
+ common.debug(`Schema compilation error: ${error.message}`);
687
+ context.warnings.push(`[W5515] schema compilation failed: ${error.message}`);
688
+ return;
689
+ }
690
+
691
+ try {
692
+ // Validate jsonConfig against schema
693
+ const valid = cachedJsonConfigValidate(jsonConfigData);
694
+
695
+ if (valid) {
696
+ context.checks.push(`${filePath} validates against schema`);
697
+ } else {
698
+ // Log individual validation errors
699
+ if (cachedJsonConfigValidate.errors) {
700
+ for (const error of cachedJsonConfigValidate.errors) {
701
+ common.debug(`Schema validation error block:\n ${JSON.stringify(error)}`);
702
+
703
+ const path = error.instancePath || 'root';
704
+ const message = error.message;
705
+
706
+ // Create a concise, developer-friendly error message
707
+ let errorMsg;
708
+ if (error.keyword === 'if') {
709
+ // ignore this error block
710
+ errorMsg = '';
711
+ } else if (error.keyword === 'required') {
712
+ errorMsg = `Missing required property "${error.params.missingProperty}" in ${path || filePath}`;
713
+ } else if (error.keyword === 'additionalProperties') {
714
+ errorMsg = `Unknown property "${error.params.additionalProperty}" in ${path}`;
715
+ } else if (error.keyword === 'type') {
716
+ errorMsg = `Property "${path}" should be ${error.params.type}`;
717
+ } else if (error.keyword === 'enum') {
718
+ errorMsg = `Property "${path}" should be one of: ${error.params.allowedValues?.join(', ')}`;
719
+ } else {
720
+ errorMsg = `Property "${path}" ${message}`;
721
+ }
722
+
723
+ if (errorMsg !== '') {
724
+ context.warnings.push(`[W5512] ${filePath} schema validation error: ${errorMsg}`);
725
+ }
726
+ }
727
+ } else {
728
+ context.warnings.push(`[W5512] ${filePath} does not validate against schema`);
729
+ }
730
+ }
731
+ } catch (error) {
732
+ common.debug(`Schema validation error: ${error.message}`);
733
+ context.warnings.push(`[W5514] ${filePath} schema validation failed: ${error.message}`);
734
+ }
735
+ }
736
+
657
737
  exports.checkJsonConfig = checkJsonConfig;
738
+ exports.validateJsonConfigSchema = validateJsonConfigSchema;
658
739
 
659
740
  // List of error and warnings used at this module
660
741
  // ----------------------------------------------
@@ -671,3 +752,6 @@ exports.checkJsonConfig = checkJsonConfig;
671
752
  // [5509] responsive check: "sm" value (${jsonConfig.sm}) greater then value for smaller displays
672
753
  // [5510] responsive check: maximum issues reached, please fix reported ones and recheck
673
754
  // [5511] invalid size attributes "${size}":"${jsonConfig[size]}" for ${component} at ${path}. Value must be 1 to 12.
755
+ // [E5512] ${filePath} schema validation error: ${errorMsg}
756
+ // [W5513] Could not download schema for validation of ${filePath}
757
+ // [E5514] ${filePath} schema validation failed: ${error.message}
@@ -13,52 +13,67 @@ const common = require('./common.js');
13
13
 
14
14
  // German language words blacklist - add new words here to extend detection
15
15
  const GERMAN_WORDS = [
16
+ 'Alarmierung',
17
+ 'Beispiel',
18
+ 'bis',
19
+ 'blockiert',
20
+ 'das',
16
21
  'der',
17
22
  'die',
18
- 'das',
19
- 'Funktion',
20
- 'Funktionen',
21
- 'Voraussetzung',
22
- 'Voraussetzungen',
23
- 'über',
24
23
  'dieser Adapter',
25
- 'Konfiguration',
26
- 'Netzwerk',
27
24
  'Einstellung',
28
25
  'Einstellungen',
26
+ 'Entwickelt mit Unterstützung von',
27
+ 'Funktion',
28
+ 'Funktionen',
29
29
  'Gerät',
30
30
  'Geräte',
31
31
  'Geräte-Konfiguration',
32
32
  'Gerätekonfiguration',
33
33
  'hinzufügen',
34
- 'nicht',
35
- 'blockiert',
36
34
  'ist',
35
+ 'Konfiguration',
36
+ 'Netzwerk',
37
+ 'nicht',
38
+ 'Oberfläche',
39
+ 'Störung',
40
+ 'Störungen',
41
+ 'technische Störung',
42
+ 'über',
43
+ 'Unterstützung',
44
+ 'vollständig',
37
45
  'von',
38
- 'bis',
46
+ 'Voraussetzung',
47
+ 'Voraussetzungen',
39
48
  'Wertebereich',
40
- 'vollständig',
41
- 'Entwickelt mit Unterstützung von',
49
+ 'Zeitfenster',
42
50
  ];
43
51
 
44
52
  // Common English words used to verify if README is written in English
45
53
  const ENGLISH_WORDS = [
46
- 'the',
47
- 'this',
48
- 'is',
49
- 'are',
50
- 'you',
51
54
  'and',
52
- 'for',
53
- 'with',
55
+ 'are',
54
56
  'configuration',
55
- 'install',
56
57
  'description',
58
+ 'device',
59
+ 'devices',
57
60
  'example',
58
- 'please',
61
+ 'fetch',
62
+ 'fetches',
63
+ 'for',
64
+ 'from',
59
65
  'if',
60
- 'that',
66
+ 'install',
67
+ 'is',
61
68
  'not',
69
+ 'please',
70
+ 'supported',
71
+ 'supports',
72
+ 'that',
73
+ 'the',
74
+ 'this',
75
+ 'with',
76
+ 'you',
62
77
  ];
63
78
 
64
79
  // Minimum number of distinct English words that must be found to consider the text English
@@ -145,6 +160,42 @@ function getWordContext(text, word) {
145
160
  return parts.join(' ');
146
161
  }
147
162
 
163
+ /**
164
+ * Remove a markdown chapter (header + all content until the next header of the same or higher level)
165
+ * that matches the given title. The comparison is case-insensitive.
166
+ * Used to exclude chapters such as "Haftungsausschluss" from language detection.
167
+ *
168
+ * @param {string} text - The markdown text to process
169
+ * @param {string} title - The chapter title to remove (case-insensitive)
170
+ * @returns {string} The text with the specified chapters removed
171
+ */
172
+ function stripChapterByTitle(text, title) {
173
+ const lines = text.split('\n');
174
+ const result = [];
175
+ let skipLevel = 0;
176
+
177
+ for (const line of lines) {
178
+ const headerMatch = line.match(/^(#{1,6})\s+(.*?)\s*$/);
179
+ if (headerMatch) {
180
+ const level = headerMatch[1].length;
181
+ if (headerMatch[2].trim().toLowerCase() === title.toLowerCase()) {
182
+ // Start skipping this chapter
183
+ skipLevel = level;
184
+ continue;
185
+ }
186
+ if (skipLevel > 0 && level <= skipLevel) {
187
+ // Stop skipping at same or higher-level header
188
+ skipLevel = 0;
189
+ }
190
+ }
191
+ if (skipLevel === 0) {
192
+ result.push(line);
193
+ }
194
+ }
195
+
196
+ return result.join('\n');
197
+ }
198
+
148
199
  /**
149
200
  * Strip markdown elements that are not visible to the user when the markdown is rendered.
150
201
  * This prevents false positives in language detection when German words appear in:
@@ -153,11 +204,14 @@ function getWordContext(text, word) {
153
204
  * - blockquote lines (lines starting with >)
154
205
  * - link URLs [text](url) — the URL part is stripped, the visible text is kept
155
206
  * - image markup ![alt](url) — stripped entirely (alt text and URL are both not rendered as prose)
207
+ * - chapters with title "Haftungsausschluss" (disclaimer sections in German)
156
208
  *
157
209
  * @param {string} text - The markdown text to process
158
210
  * @returns {string} The text with non-visible parts removed
159
211
  */
160
212
  function stripMarkdownForLanguageDetection(text) {
213
+ // Remove chapters titled "Haftungsausschluss" (German disclaimer sections)
214
+ text = stripChapterByTitle(text, 'Haftungsausschluss');
161
215
  // Remove fenced code blocks (``` ... ```) including those with a language hint (```js ... ```)
162
216
  text = text.replace(/```[\s\S]*?```/g, '');
163
217
  // Remove inline code (`...`)
@@ -114,8 +114,7 @@ async function checkDependabot(context) {
114
114
  context.warnings.push(
115
115
  `[S8901] Dependabot configuration file ".github/dependabot.yml" not found. Consider adding dependabot to keep dependencies up to date.`,
116
116
  );
117
- // Still check automerge configuration even if dependabot.yml is missing
118
- await checkAutomerge(context);
117
+ // Do not check automerge if dependabot is not configured
119
118
  return context;
120
119
  }
121
120
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "5.6.9",
2
+ "version": "5.7.1",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.18.0",
6
- "axios": "^1.13.6",
6
+ "axios": "^1.14.0",
7
7
  "compare-versions": "^6.1.1",
8
8
  "image-size": "^1.2.0",
9
9
  "js-yaml": "^4.1.1",