@iobroker/repochecker 5.21.1 → 5.22.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
@@ -56,6 +56,16 @@ GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
56
56
  Placeholder for the next version (at the beginning of the line):
57
57
  ### **WORK IN PROGRESS**
58
58
  -->
59
+ ### 5.22.0 (2026-09-11)
60
+
61
+ * (mcm1957) LICENSE file and README license section are now checked for the complete license text (see: 1160)
62
+ * (mcm1957) email addresses of author/maintainer and copyright lines (README, LICENSE) are now validated (see: 1159)
63
+ * (mcm1957) adapt sentry check
64
+
65
+ ### 5.21.2 (2026-09-08)
66
+
67
+ * (mcm1957) blacklisted @iobroker/types as dependency
68
+
59
69
  ### 5.21.1 (2026-09-08)
60
70
 
61
71
  * (mcm1957) minor fixes
@@ -124,7 +124,7 @@ const devDependenciesPackageJson = {
124
124
  '@iobroker/testing': {
125
125
  required: '5.2.2',
126
126
  recommended: '5.2.2',
127
- actual: '6.1.0',
127
+ actual: '6.2.1',
128
128
  onlyWWW: false,
129
129
  alternatives: ['@iobroker/legacy-testing'],
130
130
  },
@@ -213,6 +213,10 @@ const blacklistedDependenciesPackageJson = {
213
213
  msg: "'@alcalzone/release-script-plugin-version' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
214
214
  err: true,
215
215
  },
216
+ '@iobroker/types': {
217
+ msg: "Dependency '${dependency}' should most likely be listed as devDependency. Please check.",
218
+ err: false,
219
+ },
216
220
  '@types/.*': {
217
221
  msg: "Dependency '${dependency}' should most likely be listed as devDependency. Please check.",
218
222
  err: false,
@@ -373,10 +373,204 @@ async function checkRepository(context) {
373
373
  // Check VS Code schema definitions
374
374
  await checkVSCodeSchemas(context);
375
375
 
376
+ // Check email addresses used at author/maintainer/copyright entries
377
+ await checkEmailAddresses(context);
378
+
376
379
  return context;
377
380
  // max number is E449
378
381
  }
379
382
 
383
+ // Small list of well known disposable / one time use email providers.
384
+ // This list is intentionally kept short and can be extended if needed.
385
+ const DISPOSABLE_EMAIL_DOMAINS = [
386
+ 'mailinator.com',
387
+ 'guerrillamail.com',
388
+ 'sharklasers.com',
389
+ '10minutemail.com',
390
+ 'temp-mail.org',
391
+ 'tempmail.com',
392
+ 'trashmail.com',
393
+ 'yopmail.com',
394
+ 'getnada.com',
395
+ 'maildrop.cc',
396
+ 'throwawaymail.com',
397
+ 'dispostable.com',
398
+ 'fakeinbox.com',
399
+ ];
400
+
401
+ // Extract all email addresses contained in an arbitrary string.
402
+ function extractEmails(text) {
403
+ if (!text || typeof text !== 'string') {
404
+ return [];
405
+ }
406
+ return text.match(/[^\s<>@()]+@[^\s<>@()]+\.[a-zA-Z]{2,}/g) || [];
407
+ }
408
+
409
+ // Validate the basic format of a single email address.
410
+ function isValidEmailFormat(email) {
411
+ return typeof email === 'string' && /^[^\s<>@()]+@[^\s<>@()]+\.[a-zA-Z]{2,}$/.test(email);
412
+ }
413
+
414
+ // Read the first email address from an author/maintainer entry which may be a
415
+ // string ("Name <mail@example.com>") or an object ({ name, email }).
416
+ function getEmailFromEntry(entry) {
417
+ if (!entry) {
418
+ return null;
419
+ }
420
+ if (typeof entry === 'object' && entry.email) {
421
+ return entry.email;
422
+ }
423
+ if (typeof entry === 'string') {
424
+ return extractEmails(entry)[0] || null;
425
+ }
426
+ return null;
427
+ }
428
+
429
+ // Build a short human readable label for an author/maintainer entry.
430
+ function describeEntry(entry) {
431
+ if (!entry) {
432
+ return '<empty>';
433
+ }
434
+ if (typeof entry === 'string') {
435
+ return entry;
436
+ }
437
+ if (typeof entry === 'object') {
438
+ return entry.name || entry.email || '<empty>';
439
+ }
440
+ return '<empty>';
441
+ }
442
+
443
+ async function checkEmailAddresses(context) {
444
+ const dns = require('dns').promises;
445
+ // Map of email address -> set of locations where the address was found
446
+ const emailsToVerify = new Map();
447
+ const rememberEmail = (email, location) => {
448
+ const key = email.toLowerCase();
449
+ if (!emailsToVerify.has(key)) {
450
+ emailsToVerify.set(key, new Set());
451
+ }
452
+ emailsToVerify.get(key).add(location);
453
+ };
454
+
455
+ // Validate a group of email sources and raise at most ONE log entry for the group.
456
+ // sources: array of { label, email, location }. If at least one source provides a valid
457
+ // email the severity is reduced from error to warning, otherwise an error is raised.
458
+ // All sources with a missing or invalid address are listed within the single entry.
459
+ const checkGroup = (sources, areaDescription, errorCode) => {
460
+ const invalid = [];
461
+ let hasValid = false;
462
+ for (const source of sources) {
463
+ if (source.email && isValidEmailFormat(source.email)) {
464
+ hasValid = true;
465
+ rememberEmail(source.email, source.location);
466
+ } else {
467
+ invalid.push(source.label);
468
+ }
469
+ }
470
+
471
+ if (invalid.length === 0 && hasValid) {
472
+ context.checks.push(`Valid email address found for ${areaDescription}`);
473
+ return;
474
+ }
475
+
476
+ const detail = invalid.length ? ` (${invalid.join(', ')})` : '';
477
+ const message = `[${errorCode}] No valid email address found for ${areaDescription}${detail}`;
478
+ if (hasValid) {
479
+ // at least one valid address exists in this group -> reduce to warning
480
+ context.warnings.push(message);
481
+ } else {
482
+ context.errors.push(message);
483
+ }
484
+ };
485
+
486
+ // 1) author / maintainer of package.json and io-package.json (checked as one group)
487
+ const personSources = [];
488
+
489
+ const pkgAuthor = context.packageJson && context.packageJson.author;
490
+ if (pkgAuthor) {
491
+ personSources.push({ label: `package.json author "${describeEntry(pkgAuthor)}"`, email: getEmailFromEntry(pkgAuthor), location: 'package.json' });
492
+ }
493
+
494
+ const ioAuthors = context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.authors;
495
+ const ioAuthorsList = Array.isArray(ioAuthors) ? ioAuthors : ioAuthors ? [ioAuthors] : [];
496
+ for (const entry of ioAuthorsList) {
497
+ personSources.push({ label: `io-package.json author "${describeEntry(entry)}"`, email: getEmailFromEntry(entry), location: 'io-package.json' });
498
+ }
499
+
500
+ const maintainers = context.packageJson && context.packageJson.maintainers;
501
+ const maintainersList = Array.isArray(maintainers) ? maintainers : maintainers ? [maintainers] : [];
502
+ for (const entry of maintainersList) {
503
+ personSources.push({ label: `package.json maintainer "${describeEntry(entry)}"`, email: getEmailFromEntry(entry), location: 'package.json' });
504
+ }
505
+
506
+ checkGroup(personSources, 'author/maintainer', 'E4048');
507
+
508
+ // 2) copyright lines at README.md and LICENSE (each file checked as one group).
509
+ // A missing email address is only a suggestion here and is raised to an
510
+ // error again for new adapters via lib/postprocessing.js.
511
+ const checkCopyrightFile = async (path, fileDescription, suggestionCode) => {
512
+ let content;
513
+ try {
514
+ content = await common.getFile(context, path);
515
+ } catch {
516
+ // file existence is checked elsewhere - do not raise a second error here
517
+ return;
518
+ }
519
+ const copyrightLines = (content || '').split('\n').filter(line => /copyright/i.test(line));
520
+ const invalid = [];
521
+ for (const line of copyrightLines) {
522
+ const email = extractEmails(line)[0];
523
+ if (email && isValidEmailFormat(email)) {
524
+ rememberEmail(email, fileDescription);
525
+ } else {
526
+ invalid.push(line.trim());
527
+ }
528
+ }
529
+
530
+ if (copyrightLines.length && invalid.length === 0) {
531
+ context.checks.push(`Valid email address found for copyright line in ${fileDescription}`);
532
+ return;
533
+ }
534
+
535
+ const detail = invalid.length ? ` (${invalid.join(', ')})` : '';
536
+ context.warnings.push(`[${suggestionCode}] No valid email address found for copyright line in ${fileDescription}${detail}`);
537
+ };
538
+
539
+ await checkCopyrightFile('/README.md', 'README.md', 'S4050');
540
+ await checkCopyrightFile('/LICENSE', 'LICENSE', 'S4051');
541
+
542
+ // Additional checks for each valid email address collected above
543
+ for (const [email, locations] of emailsToVerify) {
544
+ const domain = email.split('@')[1];
545
+ const at = `at ${[...locations].join(', ')}`;
546
+
547
+ // 5) disallow GitHub noreply addresses
548
+ // warning here; raised to an error again for new adapters via lib/postprocessing.js
549
+ if (/noreply/i.test(email) && domain && domain.endsWith('github.com')) {
550
+ context.warnings.push(`[W4052] GitHub noreply email address "${email}" (${at}) is not allowed. Please use a real email address.`);
551
+ continue;
552
+ }
553
+
554
+ // 6) disallow known disposable / one time use email providers
555
+ if (domain && DISPOSABLE_EMAIL_DOMAINS.includes(domain)) {
556
+ context.warnings.push(`[W4053] Email address "${email}" (${at}) uses a known disposable email provider. Please use a permanent email address.`);
557
+ continue;
558
+ }
559
+
560
+ // 7) try to validate that the domain can receive email (MX record lookup)
561
+ try {
562
+ const records = await dns.resolveMx(domain);
563
+ if (!records || !records.length) {
564
+ context.warnings.push(`[S4054] Email address "${email}" (${at}) could not be validated - no MX record found for domain "${domain}".`);
565
+ } else {
566
+ context.checks.push(`MX record found for email domain "${domain}"`);
567
+ }
568
+ } catch {
569
+ context.warnings.push(`[S4054] Email address "${email}" (${at}) could not be validated - no MX record found for domain "${domain}".`);
570
+ }
571
+ }
572
+ }
573
+
380
574
  async function checkVSCodeSchemas(context) {
381
575
  try {
382
576
  // Try to get .vscode/settings.json file
@@ -563,3 +757,9 @@ exports.checkRepository = checkRepository;
563
757
  // [4045] Incorrect schema URL for JSON5 config files in .vscode/settings.json. Expected: "${config.schemaUrls.jsonConfig}", found: "${json5ConfigSchema.url}"
564
758
  // [4046] Could not read .vscode/settings.json file: ${error.message}
565
759
  // [4047] Adapter "${context.adapterName}" is not yet available in the stable repository.
760
+ // [4048] No valid email address found for author/maintainer${detail}
761
+ // [4050] No valid email address found for copyright line in README.md${detail} (suggestion; raised to error for new adapters)
762
+ // [4051] No valid email address found for copyright line in LICENSE${detail} (suggestion; raised to error for new adapters)
763
+ // [4052] GitHub noreply email address "${email}" (${at}) is not allowed. Please use a real email address. (warning; raised to error for new adapters)
764
+ // [4053] Email address "${email}" (${at}) uses a known disposable email provider. Please use a permanent email address.
765
+ // [4054] Email address "${email}" (${at}) could not be validated - no MX record found for domain "${domain}".
@@ -89,6 +89,9 @@ const SENTRY_NOTICE_TEXT_2 =
89
89
  'This adapter uses the service `Sentry.io` to automatically report exceptions and code errors';
90
90
  const SENTRY_NOTICE_TEXT_3 =
91
91
  'This adapter employs Sentry libraries to automatically report exceptions and code errors to the developers.';
92
+ const SENTRY_NOTICE_TEXT_4 =
93
+ 'What is Sentry.io and what is reported to the servers of that company?';
94
+
92
95
  const MARKDOWN_H1_REGEX = /^#\s+.+$/gm;
93
96
  const MARKDOWN_H2_REGEX = /^##\s+.+$/gm;
94
97
  const THIRD_H2_HEADER_INDEX = 4;
@@ -287,9 +290,10 @@ function escapeRegExp(text) {
287
290
  const SENTRY_NOTICE_REGEX_1 = new RegExp(escapeRegExp(SENTRY_NOTICE_TEXT_1).replace(/\s+/g, '\\s+'));
288
291
  const SENTRY_NOTICE_REGEX_2 = new RegExp(escapeRegExp(SENTRY_NOTICE_TEXT_2).replace(/\s+/g, '\\s+'));
289
292
  const SENTRY_NOTICE_REGEX_3 = new RegExp(escapeRegExp(SENTRY_NOTICE_TEXT_3).replace(/\s+/g, '\\s+'));
293
+ const SENTRY_NOTICE_REGEX_4 = new RegExp(escapeRegExp(SENTRY_NOTICE_TEXT_4).replace(/\s+/g, '\\s+'));
290
294
 
291
295
  function getSentryNoticeMatch(text) {
292
- return SENTRY_NOTICE_REGEX_1.exec(text) || SENTRY_NOTICE_REGEX_2.exec(text) || SENTRY_NOTICE_REGEX_3.exec(text);
296
+ return SENTRY_NOTICE_REGEX_1.exec(text) || SENTRY_NOTICE_REGEX_2.exec(text) || SENTRY_NOTICE_REGEX_3.exec(text) || SENTRY_NOTICE_REGEX_4.exec(text);
293
297
  }
294
298
 
295
299
  function getAuthor(author) {
@@ -345,6 +349,10 @@ const CHANGELOG_MD_ALLOW_LIST = ['js-controller', 'admin'];
345
349
  // Maximum number of changelog entries in README before a warning is issued about CHANGELOG_OLD.md
346
350
  const MAX_README_CHANGELOG_ENTRIES = 30;
347
351
 
352
+ // Minimum number of words the README license section must contain to be
353
+ // considered to hold the complete license text (instead of only a link).
354
+ const MIN_LICENSE_WORDS = 100;
355
+
348
356
  async function checkReadme(context) {
349
357
  // https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/README.md
350
358
  console.log('\n[E6000 - E6999] checkReadme');
@@ -611,6 +619,19 @@ async function checkReadme(context) {
611
619
  );
612
620
  }
613
621
 
622
+ // Check that the license section contains either the complete license
623
+ // text (at least MIN_LICENSE_WORDS words) or a link to the LICENSE file.
624
+ const licenseSection = findH2Section(data, 'license');
625
+ const licenseWordCount = (licenseSection.trim().match(/\S+/g) || []).length;
626
+ const hasLicenseFileLink = /\[[^\]]*\]\([^)]*LICENSE[^)]*\)/i.test(licenseSection);
627
+ if (licenseWordCount < MIN_LICENSE_WORDS && !hasLicenseFileLink) {
628
+ context.warnings.push(
629
+ '[W6034] "## License" section in README.md must contain either the complete license text or a link to the LICENSE file.',
630
+ );
631
+ } else {
632
+ context.checks.push('README.md license section contains full license text or a link to LICENSE');
633
+ }
634
+
614
635
  // Check that ## License is the last ## section in README.md
615
636
  const textAfterLicense = data.substring(pos + licenseHeaderMatch[0].length);
616
637
  if (/\n## [^#]/.test(textAfterLicense)) {
@@ -759,3 +780,4 @@ exports.checkReadme = checkReadme;
759
780
  // [E6031] Changelog section in README.md is missing entry/entries for version(s) from io-package.json news: ${missingNewsVersions.join(', ')}.
760
781
  // [W6032] Changelog section in README.md appears to use a fixed link to CHANGELOG.md. Keep changelog entries directly in README.md.
761
782
  // [E6033] "## License" section in README.md must contain a copyright line like "Copyright (c) 2026 iobroker-community-adapters".
783
+ // [W6034] "## License" section in README.md must contain either the complete license text or a link to the LICENSE file.
@@ -11,6 +11,10 @@ const execSync = require('node:child_process').execSync;
11
11
 
12
12
  const common = require('./common.js');
13
13
 
14
+ // Minimum number of words the LICENSE file must contain to be considered
15
+ // to hold the complete license text (instead of only a link or abbreviation).
16
+ const MIN_LICENSE_WORDS = 100;
17
+
14
18
  function getAuthor(author) {
15
19
  if (author && typeof author === 'object') {
16
20
  return `${author.name} <${author.email}>`;
@@ -52,6 +56,17 @@ async function checkLicenseFile(context) {
52
56
  if (data) {
53
57
  context.checks.push('LICENSE file found');
54
58
 
59
+ // The LICENSE file must always contain the complete license text
60
+ // (no link or abbreviation is accepted). Validate by word count.
61
+ const licenseWordCount = (data.trim().match(/\S+/g) || []).length;
62
+ if (licenseWordCount < MIN_LICENSE_WORDS) {
63
+ context.warnings.push(
64
+ '[W7006] LICENSE file must contain the complete license text.',
65
+ );
66
+ } else {
67
+ context.checks.push('LICENSE file contains the complete license text');
68
+ }
69
+
55
70
  let npmYear = 0;
56
71
  if (context.cfg.npmExists) {
57
72
  try {
@@ -162,3 +177,4 @@ exports.checkLicenseFile = checkLicenseFile;
162
177
  // [7003] Multiple copyright lines found in LICENSE but line(s) ${linesWithoutTrailingSpaces.join(', ')} missing trailing spaces. Add two spaces at end of each copyright line (except last) for proper formatting.
163
178
  // [7004] Copyright lines in LICENSE 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.
164
179
  // [E7005] Future year (${licenseYear}) found in LICENSE. Please use correct year at the start of LICENSE.
180
+ // [W7006] LICENSE file must contain the complete license text.
@@ -72,6 +72,9 @@ const mapSeverity4New = {
72
72
  W2007: 'E', // [W2007] Version 0.7.0-beta.2 is tagged as "latest" at npm
73
73
  W3009: 'E', // [W3009] Workflow "test-and-release.yml" is missing recommended concurrency configuration.
74
74
  S3014: 'E', // [S3014] Workflow "test-and-release.yml": job "adapter-tests" should declare "needs: check-and-lint" to run after linting.
75
+ W4052: 'E', // [W4052] GitHub noreply email address "..." is not allowed. Please use a real email address.
76
+ S4050: 'E', // [S4050] No valid email address found for copyright line in README.md
77
+ S4051: 'E', // [S4051] No valid email address found for copyright line in LICENSE
75
78
  W3019: 'E', // [W3019] Workflow "test-and-release.yml": job "deploy" step using "ioBroker/testing-action-deploy@v1" has "npm-token" parameter specified. Trusted publishing will not work while "npm-token" is set.
76
79
  W3027: 'E', // [W3027] Workflow "test-and-release.yml": job "adapter-tests" OS matrix is missing: windows-latest, macos-latest. Consider adding tests for all of: ubuntu-latest, windows-latest, macos-latest
77
80
  W3049: 'E', // [W3049] Workflow "test-and-release.yml": job "adapter-tests" step using "ioBroker/testing-action-adapter" specifies "integration-test-command". This command should not be changed; the default value should be used.
@@ -84,6 +87,8 @@ const mapSeverity4New = {
84
87
  W5612: 'E', // W5612] "admin/jsonConfig.json/items/..." attribute "label" uses key "..." which is not found in the English translation file at "admin/i18n/en".
85
88
  W6020: 'E', // [W6020] Consider adding a CHANGELOG_OLD.md file to store older changelog entries.
86
89
  W6021: 'E', // [W6021] "## License" is not the last section in README.md.
90
+ W6034: 'E', // [W6034] "## License" section in README.md must contain either the complete license text or a link to the LICENSE file.
91
+ W7006: 'E', // [W7006] LICENSE file must contain the complete license text.
87
92
  W8915: 'E', // [W8915] Dependabot npm entry (directory: "/") has no "cooldown" configured.
88
93
  W8916: 'E', // [W8916] Dependabot configuration "/.github/dependabot.yml" has no entry with "package-ecosystem: github-actions".
89
94
  W8917: 'E', // [W8917] At least major versions of @types/node should not be updated by dependabot.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.21.1",
2
+ "version": "5.22.0",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.20.0",