@iobroker/repochecker 4.3.0-alpha.0 → 5.0.0-alpha.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 +3 -0
- package/doc/issues.json +0 -6
- package/index.js +36 -36
- package/lib/{M000_PackageJson.js → M0000_PackageJson.js} +147 -147
- package/lib/{M100_IOPackageJson.js → M1000_IOPackageJson.js} +241 -239
- package/lib/{M250_Npm.js → M2000_Npm.js} +18 -18
- package/lib/{M300_Testing.js → M3000_Testing.js} +8 -8
- package/lib/{M400_Repository.js → M4000_Repository.js} +104 -104
- package/lib/{M500_Code.js → M5000_Code.js} +89 -85
- package/lib/{M500__JsonConfig.js → M5500__JsonConfig.js} +30 -30
- package/lib/{M600_Readme.js → M6000_Readme.js} +19 -19
- package/lib/{M700_License.js → M7000_License.js} +12 -12
- package/lib/{M800_Github.js → M8000_Github.js} +12 -12
- package/lib/{M900_GitNpmIgnore.js → M9000_GitNpmIgnore.js} +25 -25
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This module is a support module for iobroker.repochecker
|
|
4
4
|
|
|
5
5
|
Area checked: README file
|
|
6
|
-
Numbering :
|
|
6
|
+
Numbering : 6000 - 6999
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -20,22 +20,22 @@ function getAuthor(author) {
|
|
|
20
20
|
|
|
21
21
|
async function checkReadme(context) {
|
|
22
22
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/README.md
|
|
23
|
-
console.log('\n[
|
|
23
|
+
console.log('\n[E6000 - E6999] checkReadme');
|
|
24
24
|
|
|
25
25
|
const data = await common.getFile(context, '/README.md');
|
|
26
26
|
if (!data) {
|
|
27
|
-
context.errors.push('[
|
|
27
|
+
context.errors.push('[E6001] No README.md found');
|
|
28
28
|
} else {
|
|
29
29
|
context.checks.push('README.md found');
|
|
30
30
|
|
|
31
31
|
if (!data.includes('## Changelog')) {
|
|
32
|
-
context.errors.push('[
|
|
32
|
+
context.errors.push('[E6003] NO "## Changelog" found in README.md');
|
|
33
33
|
} else {
|
|
34
34
|
context.checks.push('README.md contains Changelog');
|
|
35
35
|
|
|
36
36
|
if (!data.includes(`### ${context.packageJson.version}`)) {
|
|
37
37
|
context.errors.push(
|
|
38
|
-
`[
|
|
38
|
+
`[E6006] Current adapter version ${context.packageJson.version} not found in README.md`,
|
|
39
39
|
);
|
|
40
40
|
} else {
|
|
41
41
|
context.checks.push('README.md contains current adapter version');
|
|
@@ -54,13 +54,13 @@ async function checkReadme(context) {
|
|
|
54
54
|
// console.log(`${latest} - ${timeStr} - ${npmYear}`);
|
|
55
55
|
}
|
|
56
56
|
} catch (e) {
|
|
57
|
-
context.warnings.push('[
|
|
57
|
+
context.warnings.push('[W6006] Could not retrieve timestamp of LATEST revision at npm.');
|
|
58
58
|
common.error(`executing "npm view" - ${e}`);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const pos = data.indexOf('## License');
|
|
62
62
|
if (pos === -1) {
|
|
63
|
-
context.errors.push('[
|
|
63
|
+
context.errors.push('[E6004] No "## License" found in README.md');
|
|
64
64
|
} else {
|
|
65
65
|
context.checks.push('## License found in README.md');
|
|
66
66
|
const text = data.substring(pos);
|
|
@@ -87,22 +87,22 @@ async function checkReadme(context) {
|
|
|
87
87
|
const m = text.match(/(\d\d\d\d)-\d\d\d\d/);
|
|
88
88
|
if (m) {
|
|
89
89
|
context.errors.push(
|
|
90
|
-
`[
|
|
90
|
+
`[E6007] Future year (${readmeYear}) found in copyright at README.md. Please use "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
91
91
|
);
|
|
92
92
|
} else {
|
|
93
93
|
context.errors.push(
|
|
94
|
-
`[
|
|
94
|
+
`[E6007] Future year (${readmeYear}) found in copyright at README.md. Please use "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
} else if (!valid) {
|
|
98
98
|
const m = text.match(/(\d\d\commitd\d)-\d\d\d\d/);
|
|
99
99
|
if (m) {
|
|
100
100
|
context.errors.push(
|
|
101
|
-
`[
|
|
101
|
+
`[E6005] No actual year found in copyright at README.md. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
102
102
|
);
|
|
103
103
|
} else {
|
|
104
104
|
context.errors.push(
|
|
105
|
-
`[
|
|
105
|
+
`[E6005] No actual year found in copyright at README.md. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
} else {
|
|
@@ -122,11 +122,11 @@ exports.checkReadme = checkReadme;
|
|
|
122
122
|
// List of error and warnings used at this module
|
|
123
123
|
// ----------------------------------------------
|
|
124
124
|
|
|
125
|
-
// [
|
|
126
|
-
// [
|
|
127
|
-
// [
|
|
128
|
-
// [
|
|
129
|
-
// [
|
|
130
|
-
// [
|
|
131
|
-
// [
|
|
132
|
-
// [
|
|
125
|
+
// [6001] No README.md found
|
|
126
|
+
// [6003] NO "## Changelog" found in README.md
|
|
127
|
+
// [6006] Current adapter version ${context.packageJson.version} not found in README.md
|
|
128
|
+
// [6004] No "## License" found in README.md
|
|
129
|
+
// [6005] No actual year found in copyright. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the end of README.md
|
|
130
|
+
// [6005] No actual year found in copyright. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the end of README.md
|
|
131
|
+
// [6006] Could not retrieve timestamp of LATEST revision at npm.
|
|
132
|
+
// [6007] Future year (${readmeYear}) found in copyright. Please use "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the end of README.md
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This module is a support module for iobroker.repochecker
|
|
4
4
|
|
|
5
5
|
Area checked: LICENSE file
|
|
6
|
-
Numbering :
|
|
6
|
+
Numbering : 7000 - 7999
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -20,16 +20,16 @@ function getAuthor(author) {
|
|
|
20
20
|
|
|
21
21
|
async function checkLicenseFile(context) {
|
|
22
22
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/LICENSE
|
|
23
|
-
console.log('\n[
|
|
23
|
+
console.log('\n[E7000 - E7999] checkLicenseFile');
|
|
24
24
|
|
|
25
25
|
let data;
|
|
26
26
|
try {
|
|
27
27
|
data = await common.getFile(context, '/LICENSE');
|
|
28
28
|
} catch (e) {
|
|
29
29
|
if (e.status == 404) {
|
|
30
|
-
context.errors.push('[
|
|
30
|
+
context.errors.push('[E7000] File LICENSE not found. Please add.');
|
|
31
31
|
} else {
|
|
32
|
-
context.errors.push(`[
|
|
32
|
+
context.errors.push(`[E7002] Cannot read LICENSE file. Please check. (Status ${e.status})`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
if (data) {
|
|
@@ -74,22 +74,22 @@ async function checkLicenseFile(context) {
|
|
|
74
74
|
const m = text.match(/(\d\d\d\d)-\d\d\d\d/);
|
|
75
75
|
if (m) {
|
|
76
76
|
context.errors.push(
|
|
77
|
-
`[
|
|
77
|
+
`[E7002] Future year (${licenseYear}) found in LICENSE. Please use "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`,
|
|
78
78
|
);
|
|
79
79
|
} else {
|
|
80
80
|
context.errors.push(
|
|
81
|
-
`[
|
|
81
|
+
`[E7002]Future year (${licenseYear}) found in LICENSE. Please use "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`,
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
} else if (!valid) {
|
|
85
85
|
const m = text.match(/(\d\d\d\d)-\d\d\d\d/);
|
|
86
86
|
if (m) {
|
|
87
87
|
context.errors.push(
|
|
88
|
-
`[
|
|
88
|
+
`[E7001] No actual year found in LICENSE. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`,
|
|
89
89
|
);
|
|
90
90
|
} else {
|
|
91
91
|
context.errors.push(
|
|
92
|
-
`[
|
|
92
|
+
`[E7001] No actual year found in LICENSE. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`,
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
} else {
|
|
@@ -105,7 +105,7 @@ exports.checkLicenseFile = checkLicenseFile;
|
|
|
105
105
|
// List of error and warnings used at this module
|
|
106
106
|
// ----------------------------------------------
|
|
107
107
|
|
|
108
|
-
// [
|
|
109
|
-
// [
|
|
110
|
-
// [
|
|
111
|
-
// [
|
|
108
|
+
// [7000] File LICENSE not found. Please add.');
|
|
109
|
+
// [7001] No actual year found in LICENSE. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE
|
|
110
|
+
// [7001] No actual year found in LICENSE. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE
|
|
111
|
+
// [7002] Cannot read LICENSE file. Please check.');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This module is a support module for iobroker.repochecker
|
|
4
4
|
|
|
5
5
|
Area checked: GitHub repository
|
|
6
|
-
Numbering :
|
|
6
|
+
Numbering : 8000 - 8999
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
9
|
const axios = require('axios');
|
|
@@ -68,11 +68,11 @@ async function getCommitInfos(context) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
async function checkGithubRepo(context) {
|
|
71
|
-
console.log('\n[
|
|
71
|
+
console.log('\n[E8000 - E8999] checkGithubRepo');
|
|
72
72
|
|
|
73
73
|
if (!context.githubApiData.description) {
|
|
74
74
|
context.errors.push(
|
|
75
|
-
`[
|
|
75
|
+
`[E8001] No repository about text found. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add the description.`,
|
|
76
76
|
);
|
|
77
77
|
} else {
|
|
78
78
|
context.checks.push('Github repository about found.');
|
|
@@ -80,14 +80,14 @@ async function checkGithubRepo(context) {
|
|
|
80
80
|
|
|
81
81
|
if (!context.githubApiData.topics || context.githubApiData.topics.length === 0) {
|
|
82
82
|
context.errors.push(
|
|
83
|
-
`[
|
|
83
|
+
`[E8002] No topics found in the repository. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add some topics.`,
|
|
84
84
|
);
|
|
85
85
|
} else {
|
|
86
86
|
context.checks.push('Github repository about found.');
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
if (context.githubApiData.archived) {
|
|
90
|
-
context.errors.push(`[
|
|
90
|
+
context.errors.push(`[E8003] Archived repositories are not allowed.`);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
const issues = await getAllIssues(context);
|
|
@@ -98,19 +98,19 @@ async function checkGithubRepo(context) {
|
|
|
98
98
|
const type = issue.pull_request ? 'PR' : 'issue';
|
|
99
99
|
if (issuesToWatchAsError.includes(issue.title)) {
|
|
100
100
|
context.errors.push(
|
|
101
|
-
`[
|
|
101
|
+
`[E8004] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
|
|
102
102
|
);
|
|
103
103
|
} else if (issuesToWatchAsWarning.includes(issue.title)) {
|
|
104
104
|
context.warnings.push(
|
|
105
|
-
`[
|
|
105
|
+
`[W8004] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
|
|
106
106
|
);
|
|
107
107
|
} else if (issue.title.startsWith('URGENT:')) {
|
|
108
108
|
context.errors.push(
|
|
109
|
-
`[
|
|
109
|
+
`[E8004] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
|
|
110
110
|
);
|
|
111
111
|
} else if (issue.title.startsWith('IMPORTANT:')) {
|
|
112
112
|
context.warnings.push(
|
|
113
|
-
`[
|
|
113
|
+
`[W8004] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -126,6 +126,6 @@ exports.checkGithubRepo = checkGithubRepo;
|
|
|
126
126
|
// List of error and warnings used at this module
|
|
127
127
|
// ----------------------------------------------
|
|
128
128
|
|
|
129
|
-
// [
|
|
130
|
-
// [
|
|
131
|
-
// [
|
|
129
|
+
// [E8001] No repository about text found. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add the description.
|
|
130
|
+
// [E8002] No topics found in the repository. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add some topics.
|
|
131
|
+
// [E8003] Archived repositories are not allowed.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This module is a support module for iobroker.repochecker
|
|
4
4
|
|
|
5
5
|
Area checked: .gitignore, .npmignore
|
|
6
|
-
Numbering :
|
|
6
|
+
Numbering : 9000 - 9998
|
|
7
7
|
|
|
8
8
|
NOTE: requires filesList to be loaded
|
|
9
9
|
*/
|
|
@@ -25,7 +25,7 @@ function paddingNum(num) {
|
|
|
25
25
|
|
|
26
26
|
// 900 - ???
|
|
27
27
|
async function checkGitIgnore(context) {
|
|
28
|
-
console.log('\n[
|
|
28
|
+
console.log('\n[E9000 - E9499] checkGitIgnore');
|
|
29
29
|
const checkFiles = ['.idea', 'tmp', 'node_modules'];
|
|
30
30
|
|
|
31
31
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/.gitignore
|
|
@@ -35,7 +35,7 @@ async function checkGitIgnore(context) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (!context.filesList.includes('/.gitignore')) {
|
|
38
|
-
context.errors.push(`[
|
|
38
|
+
context.errors.push(`[E9001] .gitignore not found`);
|
|
39
39
|
} else {
|
|
40
40
|
const rules = (context['/.gitignore'] || '')
|
|
41
41
|
.split('\n')
|
|
@@ -56,10 +56,10 @@ async function checkGitIgnore(context) {
|
|
|
56
56
|
|
|
57
57
|
/* TODO: something is wrong with undefined 'check' variable
|
|
58
58
|
if (!rules.includes('node_modules') && !rules.includes('/node_modules') && !rules.includes('/node_modules/*') && !rules.includes('node_modules/*')) {
|
|
59
|
-
!check && context.errors.push(`[
|
|
59
|
+
!check && context.errors.push(`[E9002] node_modules not found in .npmignore`);
|
|
60
60
|
}
|
|
61
61
|
if (!rules.includes('iob_npm.done') && !rules.includes('/iob_npm.done')) {
|
|
62
|
-
!check && context.errors.push(`[
|
|
62
|
+
!check && context.errors.push(`[E9003] iob_npm.done not found in .gitignore`);
|
|
63
63
|
}
|
|
64
64
|
*/
|
|
65
65
|
|
|
@@ -75,14 +75,14 @@ async function checkGitIgnore(context) {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
!check &&
|
|
78
|
-
context.errors.push(`[
|
|
78
|
+
context.errors.push(`[E9004] file ${file} found in repository, but not found in .gitignore`);
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// Check for .commitinfo file presence
|
|
84
84
|
if (context.filesList.includes('/.commitinfo')) {
|
|
85
|
-
context.errors.push('[
|
|
85
|
+
context.errors.push('[E9005] .commitinfo file found in repository, please remove it');
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// Check if .commitinfo is excluded by .gitignore (independent of file presence)
|
|
@@ -97,7 +97,7 @@ async function checkGitIgnore(context) {
|
|
|
97
97
|
if (!isIgnored) {
|
|
98
98
|
// convert to warning mid of 2026
|
|
99
99
|
context.warnings.push(
|
|
100
|
-
'[
|
|
100
|
+
'[S9006] .commitinfo file should be excluded by .gitignore, consider adding it to .gitignore',
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -108,7 +108,7 @@ async function checkGitIgnore(context) {
|
|
|
108
108
|
|
|
109
109
|
// 950 - 989
|
|
110
110
|
async function checkNpmIgnore(context) {
|
|
111
|
-
console.log('\n[
|
|
111
|
+
console.log('\n[E9500 - E9998] checkNpmIgnore');
|
|
112
112
|
const checkFiles = [
|
|
113
113
|
'node_modules/',
|
|
114
114
|
'test/',
|
|
@@ -140,7 +140,7 @@ async function checkNpmIgnore(context) {
|
|
|
140
140
|
if (context.packageJson.files && context.packageJson.files.length) {
|
|
141
141
|
if (context.filesList.includes('/.npmignore')) {
|
|
142
142
|
context.warnings.push(
|
|
143
|
-
`[
|
|
143
|
+
`[W9501] .npmignore found but "files" is used at package.json. Please remove .npmignore.`,
|
|
144
144
|
);
|
|
145
145
|
} else {
|
|
146
146
|
context.checks.push('package.json "files" already used.');
|
|
@@ -151,10 +151,10 @@ async function checkNpmIgnore(context) {
|
|
|
151
151
|
// package.json files section is NOT used
|
|
152
152
|
if (!context.filesList.includes('/.npmignore')) {
|
|
153
153
|
context.errors.push(
|
|
154
|
-
`[
|
|
154
|
+
`[E9502] neither files section at package.json nor file .npmignore found. npm package will contain unwanted files.`,
|
|
155
155
|
);
|
|
156
156
|
} else {
|
|
157
|
-
context.warnings.push(`[
|
|
157
|
+
context.warnings.push(`[W9503] .npmignore found - consider using package.json object "files" instead.`);
|
|
158
158
|
|
|
159
159
|
const rules = (context['/.npmignore'] || '')
|
|
160
160
|
.split('\n')
|
|
@@ -178,11 +178,11 @@ async function checkNpmIgnore(context) {
|
|
|
178
178
|
|
|
179
179
|
// There's no need to put node_modules in `.npmignore`. npm will never publish node_modules in the package, except if one of the modules is explicitly mentioned in bundledDependencies.
|
|
180
180
|
/*if (!rules.includes('node_modules') && !rules.includes('/node_modules') && !rules.includes('/node_modules/*') && !rules.includes('node_modules/*')) {
|
|
181
|
-
!check && context.errors.push(`[
|
|
181
|
+
!check && context.errors.push(`[E9504] node_modules not found in `.npmignore``);
|
|
182
182
|
}*/
|
|
183
183
|
if (!tooComplexToCheck) {
|
|
184
184
|
// if (!rules.includes('iob_npm.done') && !rules.includes('/iob_npm.done')) {
|
|
185
|
-
// /*!check &&*/ context.errors.push(`[
|
|
185
|
+
// /*!check &&*/ context.errors.push(`[E9505] iob_npm.done not found in .npmignore`);
|
|
186
186
|
// }
|
|
187
187
|
|
|
188
188
|
checkFiles.forEach((file, i) => {
|
|
@@ -212,16 +212,16 @@ exports.checkNpmIgnore = checkNpmIgnore;
|
|
|
212
212
|
// List of error and warnings used at this module
|
|
213
213
|
// ----------------------------------------------
|
|
214
214
|
|
|
215
|
-
// [
|
|
216
|
-
// [
|
|
217
|
-
// [
|
|
218
|
-
// [
|
|
219
|
-
// [
|
|
215
|
+
// [9001] .gitignore not found
|
|
216
|
+
// [9002] node_modules not found in .npmignore
|
|
217
|
+
// [9003] iob_npm.done not found in .gitignore
|
|
218
|
+
// [9004] file ${file} found in repository, but not found in .gitignore
|
|
219
|
+
// [9005] .commitinfo file found in repository, please remove it
|
|
220
220
|
|
|
221
|
-
// [
|
|
222
|
-
// [
|
|
223
|
-
// [
|
|
224
|
-
// [
|
|
225
|
-
// [
|
|
221
|
+
// [9501] .npmignore found but "files" is used at package.json. Please remove .npmignore.
|
|
222
|
+
// [9502] .npmignore not found
|
|
223
|
+
// [9503] .npmignore found - consider using package.json object "files" instead.
|
|
224
|
+
// [9504] node_modules not found in `.npmignore`
|
|
225
|
+
// [9505] iob_npm.done not found in .npmignore` ### removed ###
|
|
226
226
|
|
|
227
|
-
// [
|
|
227
|
+
// [W9006] .commitinfo file should be excluded by .gitignore, consider adding it to .gitignore
|
package/package.json
CHANGED