@iobroker/repochecker 5.10.3 → 5.11.0

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.11.0 (2026-04-21)
29
+ - (@copilot) Added `[W2007]`: warn when the npm `latest` dist-tag points to an alpha/pre-release version, as such releases will be ignored by repository updates.
30
+ - (@copilot) Added `lib/postprocessing.js` module: new adapters (where `isNewAdapter` is set) now have selected warnings and suggestions promoted to errors or warnings according to a configurable severity-remap table, making the checker stricter for new adapter submissions.
31
+ - (@copilot) Fixed adapter detection to ensure the `isNewAdapter` flag is set before configuration logging. Added a new `getLatestRepo` preprocessing step so that the flag is correctly visible in the environment log output.
32
+ - (@copilot) Added German translation of OBJECTDUMP.md as OBJECTDUMP_de.md.
33
+
34
+ ### 5.10.4 (2026-04-12)
35
+ - (@copilot) Enhanced E6013 check: detects additional discouraged installation methods in README.md, including `iobroker`/`iob` npm install and url commands, and `npm install`/`npm i` with `owner/iobroker.adaptername` GitHub shorthand. Updated error message to mention "directly from GitHub, directly from npm or using npm commands".
36
+
28
37
  ### 5.10.3 (2026-04-11)
29
38
  - (@copilot) Fixed false positive W5042 for TypeScript type-only imports: `import type { Foo } from 'pkg'` no longer registers `pkg` as a required runtime dependency. Related to [#833]
30
39
 
package/index.js CHANGED
@@ -30,6 +30,7 @@ const M6000_Readme = require('./lib/M6000_Readme.js');
30
30
  const M7000_License = require('./lib/M7000_License.js');
31
31
  const M8000_Github = require('./lib/M8000_Github.js');
32
32
  const M9000_GitNpmIgnore = require('./lib/M9000_GitNpmIgnore.js');
33
+ const postprocessing = require('./lib/postprocessing.js');
33
34
 
34
35
  // disable axios caching
35
36
  // axios.defaults.headers = {
@@ -148,6 +149,7 @@ function check(request, ctx, callback) {
148
149
  .then(context => M0000_PackageJson.getPackageJson(context))
149
150
  .then(context => M1000_IOPackageJson.getIOPackageJson(context))
150
151
  .then(context => M2000_Npm.getNpm(context))
152
+ .then(context => M4000_Repository.getLatestRepo(context))
151
153
  .then(context => config.updateConfig(context))
152
154
  .then(context => config.logEnvironment(context))
153
155
  .then(context => M0000_PackageJson.checkPackageJson(context))
@@ -161,6 +163,7 @@ function check(request, ctx, callback) {
161
163
  .then(context => M7000_License.checkLicenseFile(context))
162
164
  .then(context => M9000_GitNpmIgnore.checkNpmIgnore(context))
163
165
  .then(context => M9000_GitNpmIgnore.checkGitIgnore(context))
166
+ .then(context => postprocessing.postprocessing(context))
164
167
  .then(context => {
165
168
  return callback(
166
169
  null,
package/lib/M2000_Npm.js CHANGED
@@ -122,6 +122,14 @@ async function checkNpm(context) {
122
122
  }
123
123
 
124
124
  if (body['dist-tags'] && body['dist-tags'].latest) {
125
+ if (common.isAlphaVersion(body['dist-tags'].latest)) {
126
+ context.warnings.push(
127
+ `[W2007] Version ${body['dist-tags'].latest} is tagged as "latest" at npm. Pre-release versions must not be tagged as "latest" and will be ignored by repository updates.`,
128
+ );
129
+ } else {
130
+ context.checks.push(`Latest npm version ${body['dist-tags'].latest} is a normal release`);
131
+ }
132
+
125
133
  if (context.packageJson.version !== body['dist-tags'].latest) {
126
134
  if (compareVersions.compare(body['dist-tags'].latest, context.packageJson.version, '>=')) {
127
135
  context.errors.push(
@@ -196,3 +204,4 @@ exports.getNpm = getNpm;
196
204
  // [2004] Version "${missingVersions.join(', ')}" listed at common.news at io-package.json does not exist at NPM. Please remove from news section.
197
205
  // [2004] Versions "${missingVersions.join(', ')}" listed at common.news at io-package.json do not exist at NPM. Please remove from news section.
198
206
  // [2006] Package iobroker.${context.adapterName} has no valid published version on npm. Please publish a version.
207
+ // [W2007] Version ${body['dist-tags'].latest} is tagged as "latest" at npm but is a pre-release version. Alpha/pre-release versions must not be tagged as "latest" and will be ignored by repository updates.
@@ -283,7 +283,9 @@ async function checkTests(context) {
283
283
  if (context.cfg.onlyWWW) {
284
284
  context.checks.push('Job "adapter-tests" check skipped (onlyWWW adapter).');
285
285
  } else if (!jobs['adapter-tests']) {
286
- context.errors.push(`[E3011] Workflow "${WORKFLOW_FILE_SHORT}": job "adapter-tests" is missing. Please add it.`);
286
+ context.errors.push(
287
+ `[E3011] Workflow "${WORKFLOW_FILE_SHORT}": job "adapter-tests" is missing. Please add it.`,
288
+ );
287
289
  } else {
288
290
  context.checks.push('Job "adapter-tests" found.');
289
291
 
@@ -21,32 +21,51 @@ const JSON5 = require('json5');
21
21
  const common = require('./common.js');
22
22
  const config = require('./config.js');
23
23
 
24
+ async function getLatestRepo(context) {
25
+ console.log('[init] getting latest repository info');
26
+ try {
27
+ const response = await axios(
28
+ 'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
29
+ );
30
+ const body = response.data;
31
+ if (body) {
32
+ context.latestRepo = body;
33
+ if (!context.latestRepo[context.adapterName]) {
34
+ context.cfg.isNewAdapter = true;
35
+ }
36
+ }
37
+ } catch (e) {
38
+ common.error(`Cannot download latest repository info: ${e}`);
39
+ }
40
+ return context;
41
+ }
42
+
24
43
  async function checkRepository(context) {
25
44
  console.log('\n[E4000 - E4999] checking repository');
26
45
 
27
46
  if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.type) {
28
47
  /* TODO: why check type here ? */
29
- // download latest repo
30
- const response = await axios(
31
- 'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
32
- );
33
- let body = response.data;
34
- if (!body) {
35
- context.errors.push(
36
- '[E4000] Cannot download https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
48
+ let body;
49
+ // download latest repo (if not already retrieved by preprocessing)
50
+ if (!context.latestRepo) {
51
+ const response = await axios(
52
+ 'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
37
53
  );
38
- } else {
39
- context.latestRepo = body;
54
+ body = response.data;
55
+ if (!body) {
56
+ context.errors.push(
57
+ '[E4000] Cannot download https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
58
+ );
59
+ } else {
60
+ context.latestRepo = body;
61
+ }
62
+ }
63
+ if (context.latestRepo) {
40
64
  if (!context.latestRepo[context.adapterName]) {
41
65
  context.warnings.push(
42
66
  `[W4001] Cannot find "${context.adapterName}" in latest repository. Please ignore if PR to add adapter to repositories already exists.`,
43
67
  );
44
68
 
45
- context.cfg.isNewAdapter = true;
46
- common.info(
47
- `isNewAdapter is set: adapter "${context.adapterName}" is not listed in the latest repository`,
48
- );
49
-
50
69
  if (context.adapterName.includes('_')) {
51
70
  context.errors.push('[E4021] Adapter name should use "-" instead of "_"');
52
71
  } else {
@@ -489,6 +508,7 @@ async function checkVSCodeSchemas(context) {
489
508
  }
490
509
  }
491
510
 
511
+ exports.getLatestRepo = getLatestRepo;
492
512
  exports.checkRepository = checkRepository;
493
513
 
494
514
  // List of error and warnings used at this module
package/lib/M5000_Code.js CHANGED
@@ -709,7 +709,7 @@ async function checkCode(context) {
709
709
  context.ioPackageJson.common.adminUI.config === 'json' &&
710
710
  context.filesList.includes('/admin/words.js')
711
711
  ) {
712
- common.debug('/admin/words.js detected while jsonConfig is used.')
712
+ common.debug('/admin/words.js detected while jsonConfig is used.');
713
713
  let isWordsJsUsed = false;
714
714
 
715
715
  const excludeFiles = [
@@ -719,7 +719,7 @@ async function checkCode(context) {
719
719
  '/eslint.config.mjs',
720
720
  '/.eslintignore',
721
721
  '/.create-adapter.json',
722
- ];
722
+ ];
723
723
  for (const fileName of Object.keys(context)) {
724
724
  if (fileName.startsWith('/') && typeof context[fileName] === 'string' && !excludeFiles.includes(fileName)) {
725
725
  const content = context[fileName];
@@ -751,7 +751,8 @@ async function checkCode(context) {
751
751
  if (
752
752
  (context.filesList.includes('/admin/jsonConfig.json') ||
753
753
  context.filesList.includes('/admin/jsonConfig.json5')) &&
754
- (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'materialize')
754
+ context.ioPackageJson.common.adminUI &&
755
+ context.ioPackageJson.common.adminUI.config === 'materialize'
755
756
  ) {
756
757
  context.errors.push(
757
758
  '[E5046] Using admin/jsonConfig.json(5) requires common.adminUI to be set to "common.adminUI": { "config": "json" }.',
@@ -443,13 +443,29 @@ async function checkReadme(context) {
443
443
  }
444
444
 
445
445
  // Check for iobroker url (github) install instructions or other undesired install methods
446
+ const repoOwner = (context.repository || '').split('/')[0];
447
+ const escapedOwner = repoOwner.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
448
+ const escapedAdapterName = (context.adapterName || 'unknown').replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
449
+ const ownerAdapterPattern = `${escapedOwner}\\/iobroker\\.${escapedAdapterName}`;
446
450
  if (
451
+ // iobroker/iob url commands (with or without https://github.com/ prefix)
452
+ new RegExp(
453
+ `(?:^|\\n)[^\\n]*(?:iobroker|iob)\\s+url\\s+(?:https?:\\/\\/github\\.com\\/)?${ownerAdapterPattern}`,
454
+ 'i',
455
+ ).test(data) ||
456
+ // iobroker/iob npm install commands with owner/repo GitHub shorthand
457
+ new RegExp(`(?:^|\\n)[^\\n]*(?:iobroker|iob)\\s+npm\\s+install\\s+${ownerAdapterPattern}`, 'i').test(
458
+ data,
459
+ ) ||
460
+ // npm install/i with owner/repo GitHub shorthand
461
+ new RegExp(`(?:^|\\n)[^\\n]*npm\\s+(?:install|i)\\s+${ownerAdapterPattern}`, 'i').test(data) ||
462
+ // Generic iobroker url https://github.com (fallback for any GitHub URL)
447
463
  /(?:^|\n)[^\n]*iobroker\s+url\s+https:\/\/github\.com\//i.test(data) ||
448
464
  /install\s+the\s+adapter\s+via\s+iobroker\s+admin\s+as\s+a\s+zip\s+file/i.test(data) ||
449
465
  /install\s+from\s+own\s+url/i.test(data)
450
466
  ) {
451
467
  context.errors.push(
452
- '[E6013] README.md suggests to install the adapter directly from GitHub. Installation from GitHub is discouraged. Please remove these instructions.',
468
+ '[E6013] README.md suggests to install the adapter directly from GitHub, directly from npm or using npm commands. Installation from GitHub is discouraged. Please remove these instructions.',
453
469
  );
454
470
  } else {
455
471
  context.checks.push('README.md does not contain GitHub URL install instructions');
@@ -519,7 +535,7 @@ exports.checkReadme = checkReadme;
519
535
  // [6009] Multiple copyright lines found in README.md but line(s) ${linesWithoutTrailingSpaces.join(', ')} missing trailing spaces. Add two spaces at end of each copyright line (except last) for proper formatting.
520
536
  // [6011] Copyright lines in README.md are separated by empty line(s) at line(s) ${emptyLineBetweenCopyrightLines.join(', ')}. Remove the empty line(s) between copyright lines and terminate each line (except last) with two spaces.
521
537
  // [E6012] README.md contains instructions to install the adapter using direct npm commands. Adapters must not be installed using direct npm commands. Please remove these instructions.
522
- // [E6013] README.md contains instructions to install the adapter directly from GitHub using "iobroker url". Installation from GitHub is discouraged. Please remove these instructions.
538
+ // [E6013] README.md suggests to install the adapter directly from GitHub, directly from npm or using npm commands. Installation from GitHub is discouraged. Please remove these instructions.
523
539
  // [S6014] README.md contains an "## Installation" section. Adapter installation is covered by standard ioBroker procedures. This section should be removed unless the adapter requires special installation handling.
524
540
  // [E6015] README.md appears to be written in German (detected word: "..."). README.md must be written in English.
525
541
  // [W6016] README.md does not appear to be written in English. README.md must be written in English.
@@ -0,0 +1,141 @@
1
+ 'use strict';
2
+ /*
3
+ This module contains postprocessing tasks for iobroker.repochecker.
4
+
5
+ Postprocessing tasks are run after all check modules have completed and
6
+ can manipulate errors, warnings, suggestions, and infos in the context.
7
+
8
+ */
9
+
10
+ // ---------------------------------------------------------------------------
11
+ // Configuration tables
12
+ // ---------------------------------------------------------------------------
13
+
14
+ /**
15
+ * Severity remapping table for new adapters (used by adaptSeverity4New).
16
+ *
17
+ * Key : original issue key (e.g. "W0028")
18
+ * Value : target severity – one of 'E' (error), 'W' (warning), 'S' (suggestion),
19
+ * or 'N' (none / drop the issue entirely).
20
+ *
21
+ * When context.cfg.isNewAdapter is set, every raised issue whose key appears
22
+ * in this table will be removed from its current storage array and re-inserted
23
+ * with the new severity (or silently dropped for 'N').
24
+ */
25
+ const mapSeverity4New = {
26
+ W0063: 'E', // [W0063] "@types/mocha, mocha, @types/sinon, sinon"
27
+ W0028: 'E', // [W0028] Minimum node.js version 20 recommended.
28
+ W1027: 'E', // [W1027] Missing suggested translation into ru,pt,nl,fr,it,es,pl,uk,zh-cn of "common.titleLang"
29
+ W1032: 'E', // [W1032] Many "common.news" found in io-package.json
30
+ W1034: 'E', // [W1034] Missing suggested translation into ru,pt,nl,fr,it,es,pl,uk,zh-cn of "common.desc"
31
+ W1056: 'E', // [W1056] admin 7.6.17 listed as dependency but 7.6.20 is recommended.
32
+ W2007: 'E', // [W2007] Version 0.7.0-beta.2 is tagged as "latest" at npm
33
+ W3009: 'E', // [W3009] Workflow "test-and-release.yml" is missing recommended concurrency configuration.
34
+ W8915: 'E', // [W8915] Dependabot npm entry (directory: "/") has no "cooldown" configured.
35
+ W8916: 'E', // [W8916] Dependabot configuration "/.github/dependabot.yml" has no entry with "package-ecosystem: github-actions".
36
+ S0062: 'W', // [S0062] Consider adding and using package "@alcalzone/release-script".
37
+ S3012: 'E', // [S3012] Workflow "test-and-release.yml": job "deploy" is not defined.
38
+ S6008: 'E', // [S6008] Changelog for version 0.7.0-beta.19 should be added to README.md
39
+ S6020: 'W', // [S6020] Consider adding a CHANGELOG_OLD.md file to store older changelog entries. This is supported by @alcalzone/releasescript.
40
+ S8901: 'W', // [S8901] Dependabot configuration file ".github/dependabot.yml" not found. Consider adding dependabot to keep dependencies up to date.
41
+ S9006: 'E', // [S9006] .commitinfo file should be excluded by .gitignore, please add a line with text ".commitinfo" to .gitignore
42
+ };
43
+
44
+ // ---------------------------------------------------------------------------
45
+ // Postprocessing tasks
46
+ // ---------------------------------------------------------------------------
47
+
48
+ /**
49
+ * Remaps the severity of issues for new adapters according to mapSeverity4New.
50
+ *
51
+ * If context.cfg.isNewAdapter is not set the function returns immediately
52
+ * without any changes.
53
+ *
54
+ * For each entry in context.errors and context.warnings the issue key is
55
+ * extracted (e.g. "W1234" from "[W1234] …"). If the key is present in
56
+ * mapSeverity4New the entry is removed from its current array and either
57
+ * re-inserted with the new severity prefix or dropped (when target is 'N').
58
+ *
59
+ * @param {object} context - The checker context
60
+ * @returns {object} The (possibly modified) context
61
+ */
62
+ function adaptSeverity4New(context) {
63
+ if (!context.cfg || !context.cfg.isNewAdapter) {
64
+ return context;
65
+ }
66
+
67
+ /**
68
+ * Process a single array of issue strings in-place.
69
+ * Entries that need to change severity are removed and collected for
70
+ * re-insertion so that the iteration index stays consistent.
71
+ *
72
+ * @param {string[]} sourceArray - The array to scan (errors or warnings)
73
+ */
74
+ function processArray(sourceArray) {
75
+ // Collect items to re-route so we don't mutate while iterating
76
+ const toReroute = [];
77
+
78
+ for (let i = sourceArray.length - 1; i >= 0; i--) {
79
+ const entry = sourceArray[i];
80
+ const match = entry.match(/^\[([EWSI]\d+)\]/);
81
+ if (!match) {
82
+ continue;
83
+ }
84
+
85
+ const issueKey = match[1]; // e.g. "W1234"
86
+ if (!Object.prototype.hasOwnProperty.call(mapSeverity4New, issueKey)) {
87
+ continue;
88
+ }
89
+
90
+ const targetSeverity = mapSeverity4New[issueKey];
91
+
92
+ // Remove from current position
93
+ sourceArray.splice(i, 1);
94
+
95
+ if (targetSeverity !== 'N') {
96
+ // Replace the key prefix in the message, e.g. [W1234] -> [E1234]
97
+ const numPart = issueKey.slice(1); // "1234"
98
+ const newKey = `${targetSeverity}${numPart}`;
99
+ const newEntry = entry.replace(`[${issueKey}]`, `[${newKey}]`);
100
+ toReroute.push({ severity: targetSeverity, entry: newEntry });
101
+ }
102
+ }
103
+
104
+ // Re-insert into the correct arrays
105
+ for (const { severity, entry } of toReroute) {
106
+ if (severity === 'E') {
107
+ context.errors.push(entry);
108
+ } else {
109
+ // 'W' and 'S' both live in context.warnings
110
+ context.warnings.push(entry);
111
+ }
112
+ }
113
+ }
114
+
115
+ processArray(context.errors);
116
+ processArray(context.warnings);
117
+
118
+ return context;
119
+ }
120
+
121
+ // ---------------------------------------------------------------------------
122
+ // Main postprocessing orchestrator
123
+ // ---------------------------------------------------------------------------
124
+
125
+ /**
126
+ * Runs all postprocessing tasks sequentially.
127
+ * Each task receives the full context and may modify errors, warnings,
128
+ * suggestions, and infos before the results are returned to the caller.
129
+ *
130
+ * @param {object} context - The checker context
131
+ * @returns {object} The context after all postprocessing tasks have run
132
+ */
133
+ function postprocessing(context) {
134
+ console.log('\n[postprocessing] running postprocessing tasks');
135
+
136
+ adaptSeverity4New(context);
137
+
138
+ return context;
139
+ }
140
+
141
+ exports.postprocessing = postprocessing;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "5.10.3",
2
+ "version": "5.11.0",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.18.0",
6
- "axios": "^1.14.0",
6
+ "axios": "^1.15.0",
7
7
  "compare-versions": "^6.1.1",
8
8
  "image-size": "^1.2.0",
9
9
  "js-yaml": "^4.1.1",