@iobroker/repochecker 3.1.4 → 3.2.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.
@@ -0,0 +1,603 @@
1
+ /* eslint-disable no-unused-vars */
2
+ 'use strict';
3
+ /*
4
+ This module is a support module for iobroker.repochecker
5
+
6
+ Area checked: Adapter Code
7
+ Numbering : 500 - 599
8
+
9
+ Extension to check jsonConfig
10
+
11
+ */
12
+
13
+ /*
14
+
15
+ Open questions:
16
+ - should HEADER have size attributes ?
17
+
18
+ */
19
+
20
+ const common = require('./common.js');
21
+
22
+ let responsiveErrorLimit = 5;
23
+
24
+ const stdAttributes = [
25
+ 'xl',
26
+ 'lg',
27
+ 'md',
28
+ 'sm',
29
+ 'xs',
30
+
31
+ 'darkStyle',
32
+ 'default',
33
+ 'defaultFunc',
34
+ 'disabled',
35
+ 'doNotSave',
36
+ 'help',
37
+ 'helpLink',
38
+ 'hidden',
39
+ 'hideOnlyControl',
40
+ 'label',
41
+ 'newLine',
42
+ 'noMultiEdit',
43
+ 'noTranslation',
44
+ 'onChange',
45
+ 'placeholder',
46
+ 'style',
47
+ 'tooltip',
48
+ 'validator',
49
+ 'validatorErrorText',
50
+ 'validatorNoSaveOnError',
51
+
52
+ '#include'
53
+ ];
54
+
55
+ const validComponents = {
56
+ 'accordion':check_accordion,
57
+ 'alive': check_alive,
58
+ 'autocomplete': check_autocomplete,
59
+ 'autocompleteSendTo': check_autocompleteSendTo,
60
+
61
+ 'certificate': check_certificate,
62
+ 'certificates': check_certificates,
63
+ 'certificateCollection': check_certificateCollection,
64
+ 'checkbox': check_checkbox,
65
+ 'checkLicense': check_checkLicense,
66
+ 'chips': check_chips,
67
+ 'color': check_color,
68
+ 'coordinates': check_coordinates,
69
+ 'cron': check_cron,
70
+ 'custom': check_custom,
71
+ 'datePicker': check_datePicker,
72
+ 'deviceManager': check_deviceManager,
73
+ 'divider': check_divider,
74
+
75
+ 'file': check_file,
76
+ 'fileSelector': check_fileSelector,
77
+ 'func': check_func,
78
+
79
+ 'header': check_header,
80
+
81
+ 'image': check_image,
82
+ 'imageSendTo': check_imageSendTo,
83
+ 'instance': check_instance,
84
+ 'interface': check_interface,
85
+ 'ip': check_ip,
86
+
87
+ 'jsonEditor': check_jsonEditor,
88
+
89
+ 'language': check_language,
90
+ 'license': check_license,
91
+
92
+ 'number': check_number,
93
+
94
+ 'objectId': check_objectId,
95
+
96
+ 'password': check_password,
97
+ 'pattern': check_pattern,
98
+ 'port': check_port,
99
+
100
+ 'qrCode': check_qrCode,
101
+
102
+ 'room': check_room,
103
+
104
+ 'select': check_select,
105
+ 'selectSendTo': check_selectSendTo,
106
+ 'sendTo': check_sendTo,
107
+ 'setState': check_setState,
108
+ 'slider': check_slider,
109
+ 'state': check_state,
110
+ 'staticImage': check_staticImage,
111
+ 'staticLink': check_staticLink,
112
+ 'staticText': check_staticText,
113
+
114
+ 'table': check_table,
115
+ 'text': check_text,
116
+ 'textSendTo': check_textSendTo,
117
+ 'timePicker': check_timePicker,
118
+
119
+ 'user': check_user,
120
+ 'uuid': check_uuid,
121
+ };
122
+
123
+ function handleResponsiveError(context, msg) {
124
+ if (responsiveErrorLimit) {
125
+ context.errors.push(`${msg}`);
126
+ responsiveErrorLimit--;
127
+ if (responsiveErrorLimit === 0) {
128
+ context.errors.push(`[E510] responsive check: maximum issues reached, please fix reported ones and recheck`);
129
+ }
130
+ }
131
+ }
132
+
133
+ function chk_responsive (context, path, jsonConfig){
134
+ common.debug(`chk_responsive ${path}`);
135
+ const missing = [];
136
+ if (!jsonConfig.xs) missing.push('xs');
137
+ if (!jsonConfig.sm) missing.push('sm');
138
+ if (!jsonConfig.md) missing.push('md');
139
+ if (!jsonConfig.lg) missing.push('lg');
140
+ if (!jsonConfig.xl) missing.push('xl');
141
+ if (missing.length) {
142
+ handleResponsiveError(context, `[E507] responsive check: missing size attributes [${missing.join(',')}] at ${path}`);
143
+ }
144
+
145
+ if ( jsonConfig.xs && jsonConfig.xs != 12) {
146
+ handleResponsiveError(context, `[E508] responsive check: attribute "xs" should specify a value of "12" at ${path}`);
147
+ }
148
+
149
+ let ii = 12;
150
+ if (jsonConfig.xs) ii = jsonConfig.xs;
151
+ if (jsonConfig.sm && jsonConfig.sm > ii ) {
152
+ handleResponsiveError(context, `[E509] responsive check: "sm" value (${jsonConfig.sm}) greater then value for smaller displays`);
153
+ } else {
154
+ ii = jsonConfig.sm;
155
+ }
156
+ if (jsonConfig.md && jsonConfig.md > ii ) {
157
+ handleResponsiveError(context, `[E509] responsive check: "md" value (${jsonConfig.md}) greater then value for smaller displays`);
158
+ } else {
159
+ ii = jsonConfig.md;
160
+ }
161
+ if (jsonConfig.lg && jsonConfig.lg > ii ) {
162
+ handleResponsiveError(context, `[E509] responsive check: "lg" value (${jsonConfig.lg}) greater then value for smaller displays`);
163
+ } else {
164
+ ii = jsonConfig.lg;
165
+ }
166
+ if (jsonConfig.xl && jsonConfig.xl > ii ) {
167
+ handleResponsiveError(context, `[E509] responsive check: "xl" value (${jsonConfig.xl}) greater then value for smaller displays`);
168
+ }
169
+ }
170
+
171
+ function check_accordion (context, path, jsonConfig, inTable){
172
+ common.debug(`check_accordion ${path}`);
173
+ chk_responsive(context, path, jsonConfig);
174
+ }
175
+
176
+ function check_alive(context, path, jsonConfig, inTable){
177
+ common.debug(`check_alive ${path}`);
178
+ chk_responsive(context, path, jsonConfig);
179
+ }
180
+
181
+ function check_autocomplete(context, path, jsonConfig, inTable){
182
+ common.debug(`check_autocomplete ${path}`);
183
+ chk_responsive(context, path, jsonConfig);
184
+ }
185
+
186
+ function check_autocompleteSendTo(context, path, jsonConfig, inTable){
187
+ common.debug(`check_autocompleteSendTo ${path}`);
188
+ chk_responsive(context, path, jsonConfig);
189
+ }
190
+
191
+ function check_certificate(context, path, jsonConfig, inTable){
192
+ common.debug(`check_certificate ${path}`);
193
+ chk_responsive(context, path, jsonConfig);
194
+ }
195
+
196
+ function check_certificates(context, path, jsonConfig, inTable){
197
+ common.debug(`check_certificates ${path}`);
198
+ chk_responsive(context, path, jsonConfig);
199
+ }
200
+
201
+ function check_certificateCollection(context, path, jsonConfig, inTable){
202
+ common.debug(`check_certificateCollection ${path}`);
203
+ chk_responsive(context, path, jsonConfig);
204
+ }
205
+
206
+ function check_checkbox(context, path, jsonConfig, inTable){
207
+ common.debug(`check_checkbox ${path}`);
208
+ chk_responsive(context, path, jsonConfig);
209
+ }
210
+
211
+ function check_checkLicense(context, path, jsonConfig, inTable){
212
+ common.debug(`check_checkLicense ${path}`);
213
+ chk_responsive(context, path, jsonConfig);
214
+ }
215
+
216
+ function check_chips(context, path, jsonConfig, inTable){
217
+ common.debug(`check_chips ${path}`);
218
+ chk_responsive(context, path, jsonConfig);
219
+ }
220
+
221
+ function check_color(context, path, jsonConfig, inTable){
222
+ common.debug(`check_color ${path}`);
223
+ chk_responsive(context, path, jsonConfig);
224
+ }
225
+
226
+ function check_coordinates(context, path, jsonConfig, inTable){
227
+ common.debug(`check_coordinates ${path}`);
228
+ chk_responsive(context, path, jsonConfig);
229
+ }
230
+
231
+ function check_cron(context, path, jsonConfig, inTable){
232
+ common.debug(`check_staticText ${path}`);
233
+ chk_responsive(context, path, jsonConfig);
234
+ }
235
+
236
+ function check_custom(context, path, jsonConfig, inTable){
237
+ common.debug(`check_custom ${path}`);
238
+ chk_responsive(context, path, jsonConfig);
239
+ }
240
+
241
+ function check_datePicker(context, path, jsonConfig, inTable){
242
+ common.debug(`check_datePicker ${path}`);
243
+ chk_responsive(context, path, jsonConfig);
244
+ }
245
+
246
+ function check_deviceManager(context, path, jsonConfig, inTable){
247
+ common.debug(`check_deviceManager ${path}`);
248
+ chk_responsive(context, path, jsonConfig);
249
+ }
250
+
251
+ function check_divider(context, path, jsonConfig, inTable){
252
+ common.debug(`check_divider ${path}`);
253
+ chk_responsive(context, path, jsonConfig);
254
+ }
255
+
256
+ function check_file(context, path, jsonConfig, inTable){
257
+ common.debug(`check_file ${path}`);
258
+ chk_responsive(context, path, jsonConfig);
259
+ }
260
+
261
+ function check_fileSelector(context, path, jsonConfig, inTable){
262
+ common.debug(`check_fileSelector ${path}`);
263
+ chk_responsive(context, path, jsonConfig);
264
+ }
265
+
266
+ function check_func(context, path, jsonConfig, inTable){
267
+ common.debug(`check_func ${path}`);
268
+ chk_responsive(context, path, jsonConfig);
269
+ }
270
+
271
+ function check_header(context, path, jsonConfig, inTable){
272
+ common.debug(`check_header ${path}`);
273
+ // chk_responsive(context, path, jsonConfig); // must be discussed
274
+ }
275
+
276
+ function check_image(context, path, jsonConfig, inTable){
277
+ common.debug(`check_image ${path}`);
278
+ chk_responsive(context, path, jsonConfig);
279
+ }
280
+
281
+ function check_imageSendTo(context, path, jsonConfig, inTable){
282
+ common.debug(`check_imageSendTo ${path}`);
283
+ chk_responsive(context, path, jsonConfig);
284
+ }
285
+
286
+ function check_instance(context, path, jsonConfig, inTable){
287
+ common.debug(`check_instance ${path}`);
288
+ chk_responsive(context, path, jsonConfig);
289
+ }
290
+
291
+ function check_interface(context, path, jsonConfig, inTable){
292
+ common.debug(`check_interface ${path}`);
293
+ chk_responsive(context, path, jsonConfig);
294
+ }
295
+
296
+ function check_ip(context, path, jsonConfig, inTable){
297
+ common.debug(`check_ip ${path}`);
298
+ chk_responsive(context, path, jsonConfig);
299
+ }
300
+
301
+ function check_jsonEditor(context, path, jsonConfig, inTable){
302
+ common.debug(`check_jsonEditor ${path}`);
303
+ chk_responsive(context, path, jsonConfig);
304
+ }
305
+
306
+ function check_language(context, path, jsonConfig, inTable){
307
+ common.debug(`check_language ${path}`);
308
+ chk_responsive(context, path, jsonConfig);
309
+ }
310
+
311
+ function check_license(context, path, jsonConfig, inTable){
312
+ common.debug(`check_license ${path}`);
313
+ chk_responsive(context, path, jsonConfig);
314
+ }
315
+
316
+ function check_number(context, path, jsonConfig, inTable){
317
+ common.debug(`check_number ${path}`);
318
+ chk_responsive(context, path, jsonConfig);
319
+ }
320
+
321
+ function check_objectId(context, path, jsonConfig, inTable){
322
+ common.debug(`check_objectId ${path}`);
323
+ chk_responsive(context, path, jsonConfig);
324
+ }
325
+
326
+ function check_password(context, path, jsonConfig, inTable){
327
+ common.debug(`check_password ${path}`);
328
+ chk_responsive(context, path, jsonConfig);
329
+ }
330
+
331
+ function check_pattern(context, path, jsonConfig, inTable){
332
+ common.debug(`check_pattern ${path}`);
333
+ chk_responsive(context, path, jsonConfig);
334
+ }
335
+
336
+ function check_port(context, path, jsonConfig, inTable){
337
+ common.debug(`check_port ${path}`);
338
+ chk_responsive(context, path, jsonConfig);
339
+ }
340
+
341
+ function check_qrCode(context, path, jsonConfig, inTable){
342
+ common.debug(`check_qrCode ${path}`);
343
+ chk_responsive(context, path, jsonConfig);
344
+ }
345
+
346
+ function check_room(context, path, jsonConfig, inTable){
347
+ common.debug(`check_room ${path}`);
348
+ chk_responsive(context, path, jsonConfig);
349
+ }
350
+
351
+ function check_select(context, path, jsonConfig, inTable){
352
+ common.debug(`check_select ${path}`);
353
+ chk_responsive(context, path, jsonConfig);
354
+ }
355
+
356
+ function check_selectSendTo(context, path, jsonConfig, inTable){
357
+ common.debug(`check_selectSendTo ${path}`);
358
+ chk_responsive(context, path, jsonConfig);
359
+ }
360
+
361
+ function check_sendTo(context, path, jsonConfig, inTable){
362
+ common.debug(`check_sendTo ${path}`);
363
+ chk_responsive(context, path, jsonConfig);
364
+ }
365
+
366
+ function check_setState(context, path, jsonConfig, inTable){
367
+ common.debug(`check_setState ${path}`);
368
+ chk_responsive(context, path, jsonConfig);
369
+ }
370
+
371
+ function check_slider(context, path, jsonConfig, inTable){
372
+ common.debug(`check_slider ${path}`);
373
+ chk_responsive(context, path, jsonConfig);
374
+ }
375
+
376
+ function check_state(context, path, jsonConfig, inTable){
377
+ common.debug(`check_state ${path}`);
378
+ chk_responsive(context, path, jsonConfig);
379
+ }
380
+
381
+ function check_staticImage(context, path, jsonConfig, inTable){
382
+ common.debug(`check_staticImage ${path}`);
383
+ chk_responsive(context, path, jsonConfig);
384
+ }
385
+
386
+ function check_staticLink(context, path, jsonConfig, inTable){
387
+ common.debug(`check_staticLink ${path}`);
388
+ chk_responsive(context, path, jsonConfig);
389
+ }
390
+
391
+ function check_staticText(context, path, jsonConfig, inTable){
392
+ common.debug(`check_staticText ${path}`);
393
+ chk_responsive(context, path, jsonConfig);
394
+ }
395
+
396
+ function check_table(context, path, jsonConfig, inTable){
397
+ common.debug(`check_table ${path}`);
398
+ chk_responsive(context, path, jsonConfig);
399
+ }
400
+
401
+ function check_text(context, path, jsonConfig, inTable){
402
+ common.debug(`check_text ${path}`);
403
+ chk_responsive(context, path, jsonConfig);
404
+ }
405
+
406
+ function check_textSendTo(context, path, jsonConfig, inTable){
407
+ common.debug(`check_textSendTo ${path}`);
408
+ chk_responsive(context, path, jsonConfig);
409
+ }
410
+
411
+ function check_timePicker(context, path, jsonConfig, inTable){
412
+ common.debug(`check_timePicker ${path}`);
413
+ chk_responsive(context, path, jsonConfig);
414
+ }
415
+
416
+ function check_user(context, path, jsonConfig, inTable){
417
+ common.debug(`check_user ${path}`);
418
+ chk_responsive(context, path, jsonConfig);
419
+ }
420
+
421
+ function check_uuid(context, path, jsonConfig, inTable){
422
+ common.debug(`check_uuid ${path}`);
423
+ chk_responsive(context, path, jsonConfig);
424
+ }
425
+
426
+
427
+ function checkComponent(context, path, jsonConfig) {
428
+ common.debug(`checkComponent (${path})`);
429
+
430
+ const type = jsonConfig.type;
431
+ if (!type) {
432
+ context.errors.push(`[E502] no type specified at ${path}`);
433
+ }
434
+ common.debug(` type ${type}`);
435
+
436
+ if (validComponents[type] === undefined) {
437
+ context.errors.push(`[E504] unexpected component "${type}" detected at ${path}`);
438
+ } else if (typeof(validComponents[type]) === 'function') {
439
+ (validComponents[type])(context, path, jsonConfig, false);
440
+ } else {
441
+ common.debug(`no checks defined for component ${type}`);
442
+ }
443
+
444
+ }
445
+
446
+ function checkPanel(context, path, jsonConfig, isRoot) {
447
+ common.debug(`checkPanel(${path})`);
448
+
449
+ const rootAttributes = [
450
+ 'i18n',
451
+ ];
452
+
453
+ const myAttributes = [
454
+ 'type',
455
+
456
+ 'collapsable',
457
+ 'color',
458
+ 'icon',
459
+ 'innerStyle',
460
+ 'items',
461
+ 'label',
462
+ ];
463
+
464
+ const validAttributes = stdAttributes.concat(myAttributes).concat(isRoot?rootAttributes:[]);
465
+
466
+ for (const key in jsonConfig) {
467
+ common.debug(` scanning ${key}`);
468
+
469
+ if (!validAttributes.includes(key)) {
470
+ context.errors.push(`[E503] unexpected type "${key}" detected at ${path}`);
471
+ }
472
+
473
+ if (key === 'type') {
474
+ if (jsonConfig[key] !== 'panel') {
475
+ console.log( `INTERNAL ERROR: unexpected type ${jsonConfig[key]} encounterd while scanning "panel"`);
476
+ return;
477
+ }
478
+ }
479
+
480
+ if (key === 'items') {
481
+ for (const subkey in jsonConfig['items']) {
482
+ const type = jsonConfig['items'][subkey].type;
483
+ common.debug(` item ${subkey} / ${type}`);
484
+ if (!type) {
485
+ context.errors.push(`[E502] no type specified at ${path}`);
486
+ }
487
+
488
+ checkComponent(context, `${path}/${subkey}`, jsonConfig['items'][subkey]);
489
+ }
490
+ }
491
+ }
492
+ }
493
+
494
+ function checkTabs(context, path, jsonConfig) {
495
+ common.debug(`${path}`);
496
+
497
+ // const validTypes = [
498
+ // 'panel'
499
+ // ];
500
+
501
+ // const validAttributes = [
502
+ // 'type',
503
+
504
+ // 'collapsable',
505
+ // 'color',
506
+ // 'icon',
507
+ // 'iconPosition',
508
+ // ];
509
+
510
+ for (const key in jsonConfig) {
511
+ common.debug(` scanning ${key}`);
512
+
513
+ const type = jsonConfig[key].type;
514
+ common.debug(` item ${key} / ${type}`);
515
+ if (!type) {
516
+ context.errors.push(`[E502] no type specified at ${path}; expected "panel"`);
517
+ }
518
+ if (type !== 'panel') {
519
+ context.errors.push(`[E503] unexpected type "${key}" detected at ${path}; expected "panel"`);
520
+ } else {
521
+ checkPanel(context, `${path}/${key}`, jsonConfig[key]);
522
+ }
523
+ }
524
+ }
525
+
526
+ //main entry
527
+ function checkJsonConfig(context, path, jsonConfig) {
528
+ common.debug(`checkCode_jsonConfig({context}, ${path}, {jsonConfig}`);
529
+
530
+ const commonAttributes = [
531
+ 'i18n',
532
+ 'items',
533
+ 'type',
534
+ ];
535
+
536
+ const panelAttributes = [
537
+ 'collapsable',
538
+ 'color',
539
+ 'icon',
540
+ 'innerStyle',
541
+ 'label',
542
+ ];
543
+
544
+ const tabsAttributes = [
545
+ 'iconPosition',
546
+ 'tabsStyle',
547
+ ];
548
+
549
+ const validTypes = [
550
+ 'panel',
551
+ 'tabs',
552
+ ];
553
+
554
+ let baseType = 'panel';
555
+ if (!jsonConfig['type']) {
556
+ console.log(`*ERROR* base type (panel / tabs) not specified`);
557
+ } else {
558
+ baseType = jsonConfig['type'];
559
+ common.debug(` base type ${baseType}`);
560
+ if (!validTypes.includes(baseType)) {
561
+ context.errors.push(`[E500] unexpected base type "!${baseType}" detected at ${path}`);
562
+ }
563
+ }
564
+
565
+ let validAttributes = commonAttributes;
566
+ if (baseType === 'panel') validAttributes = validAttributes.concat(panelAttributes);
567
+ if (baseType === 'tabs') validAttributes = validAttributes.concat(tabsAttributes);
568
+
569
+ for (const key in jsonConfig) {
570
+ common.debug(``);
571
+ common.debug(`scanning base attribute ${key}`);
572
+ if (!validAttributes.includes(key)) {
573
+ context.errors.push(`[E501] unexpected attribute "${key}" detected at ${path}`);
574
+ }
575
+ if (key === 'items') {
576
+ if (baseType == 'panel') {
577
+ checkPanel( context, `${path}/items`, jsonConfig, true);
578
+ } else if (baseType == 'tabs') {
579
+ checkTabs( context, `${path}/items`, jsonConfig['items'], false);
580
+ }
581
+ }
582
+ }
583
+
584
+ return;
585
+ }
586
+
587
+ exports.checkJsonConfig = checkJsonConfig;
588
+
589
+ // List of error and warnings used at this module
590
+ // ----------------------------------------------
591
+
592
+ // [500] unexpected base type "!${baseType}" detected at ${path}
593
+ // [501] unexpected attribute "${key}" detected at ${path}
594
+ // [502] no type specified at ${path}
595
+ // [503] unexpected type "${key}" detected at ${path}
596
+ // [504] unexpected component "${type}" detected at ${path}
597
+ // [505]
598
+ // [506]
599
+ // [507] responsive check: missing size attributes [${missing.join(',')}] at ${path}
600
+ // [508] responsive check: attribute "xs" should specify a value of "12" at ${path}
601
+ // [509] responsive check: "sm" value (${jsonConfig.sm}) greater then value for smaller displays
602
+ // [510] responsive check: maximum issues reached, please fix reported ones and recheck
603
+
@@ -29,7 +29,7 @@ async function checkLicenseFile(context) {
29
29
  } catch (e) {
30
30
  if (e.status == 404) {
31
31
  context.errors.push('[E700] File LICENSE not found. Please add.');
32
- } else{
32
+ } else {
33
33
  context.errors.push(`[E702] Cannot read LICENSE file. Please check. (Status ${e.status})`);
34
34
  }
35
35
  }
@@ -61,7 +61,7 @@ async function checkLicenseFile(context) {
61
61
  }
62
62
  m = text.match(/(\d\d\d\d)/);
63
63
  if (m) {
64
- if (Number(m[1])>licenseYear) {
64
+ if (Number(m[1]) > licenseYear) {
65
65
  licenseYear = Number(m[1]);
66
66
  }
67
67
  }
@@ -71,7 +71,7 @@ async function checkLicenseFile(context) {
71
71
  console.log(`Commit year ${commitYear}`);
72
72
  console.log(`NPM year ${npmYear}`);
73
73
 
74
- const valid = (licenseYear === year || licenseYear >= commitYear || licenseYear >=npmYear);
74
+ const valid = (licenseYear === year || licenseYear >= commitYear || licenseYear >= npmYear);
75
75
  if (!valid) {
76
76
  const m = text.match(/(\d\d\d\d)-\d\d\d\d/);
77
77
  if (m) {
@@ -8,6 +8,11 @@
8
8
  */
9
9
  const axios = require('axios');
10
10
 
11
+ const issuesToWatch = [
12
+ 'IMPORTANT: Update of dependency @iobroker/adapter-core is required as soon as possible',
13
+ 'Compatibility check and testing for node.js 22',
14
+ ];
15
+
11
16
  // disable axios caching
12
17
  axios.defaults.headers = {
13
18
  'Cache-Control': 'no-cache',
@@ -17,24 +22,11 @@ axios.defaults.headers = {
17
22
 
18
23
  const common = require('./common.js');
19
24
 
20
- // async function getCommitInfos(context) {
21
- // console.log('\ngetCommitInfos');
22
- // context.lastCommitYear = 0;
23
- // try{
24
- // const data = await common.downloadFile(context.githubUrlOriginal, `/commits/${context.branch}`)
25
- // const m = data.match(/Commits on [\w\s\d]+, (\d\d\d\d)/);
26
- // if (m) {
27
- // context.lastCommitYear = Number(m[1]);
28
- // common.debug (`lastCommitYear: ${context.lastCommitYear}`);
29
- // } else {
30
- // common.debug (`lastCommitYear: not found within data returned`);
31
- // }
32
- // } catch (e) {
33
- // console.log( '[INTERNAL] error retrieving commit info - ${e}');
34
- // }
35
-
36
- // return context;
37
- // }
25
+ async function getAllIssues(context) {
26
+ //console.log('\ngetAllIssues');
27
+ const response = await axios(`${context.githubUrlApi}/issues`, {});
28
+ return response.data;
29
+ }
38
30
 
39
31
  async function getCommitInfos(context) {
40
32
  console.log('\ngetCommitInfos');
@@ -57,13 +49,13 @@ async function getCommitInfos(context) {
57
49
  const lastCommitDate = new Date(lastCommit.commit.author.date);
58
50
  context.lastCommitYear = lastCommitDate.getUTCFullYear().toString();
59
51
 
60
- common.debug (`lastCommitSha : ${context.lastCommitSha}`);
61
- common.debug (`lastCommitYear: ${context.lastCommitYear}`);
52
+ common.debug(`lastCommitSha : ${context.lastCommitSha}`);
53
+ common.debug(`lastCommitYear: ${context.lastCommitYear}`);
62
54
 
63
55
  return context;
64
56
  }
65
57
 
66
- function checkGithubRepo(context) {
58
+ async function checkGithubRepo(context) {
67
59
  console.log('\ncheckGithubRepo [E8xx]');
68
60
 
69
61
  if (!context.githubApiData.description) {
@@ -82,6 +74,14 @@ function checkGithubRepo(context) {
82
74
  context.errors.push(`[E803] Archived repositories are not allowed.`);
83
75
  }
84
76
 
77
+ const issues = await getAllIssues(context);
78
+ for (const issue of issues){
79
+ if (issue.pull_request) continue;
80
+ if (issuesToWatch.includes(issue.title)) {
81
+ context.errors.push(`[E804] Please process issue [#${issue.number}] "${issue.title}."`);
82
+ }
83
+ }
84
+
85
85
  // max E803 - limited to 849
86
86
 
87
87
  return context;
@@ -34,7 +34,7 @@ async function checkGitIgnore(context) {
34
34
  console.log('\ncheckGitIgnore [E9xx]');
35
35
 
36
36
  if (!context.filesList) {
37
- throw('FATAL:context.fileslist is undefined');
37
+ throw ('FATAL:context.fileslist is undefined');
38
38
  }
39
39
 
40
40
  if (!context.filesList.includes('.gitignore')) {