@iobroker/repochecker 4.2.0 → 4.2.1-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 CHANGED
@@ -31,8 +31,10 @@ npx @iobroker/repochecker https://github.com/ioBroker/ioBroker.javascript --loca
31
31
  Placeholder for the next version (at the beginning of the line):
32
32
  ### **WORK IN PROGRESS**
33
33
  -->
34
+ ### 4.2.1-alpha.0 (2025-09-27)
35
+ - (@copilot) Added structured GitHub issue templates for bug reports, false positives, new checks, check changes, and enhancements
36
+ - (@copilot) Fixed deprecated function checking for adapter methods called outside class context
34
37
 
35
- ## Changelog
36
38
  ### 4.2.0 (2025-09-20)
37
39
  - (mcm1957) 'Request' replacement text changed to suggest 'node:fetch' [#498].
38
40
  - (@copilot) Fixed false positive W533 warnings for deprecated adapter methods when called on local functions with same names [#520].
package/lib/M500_Code.js CHANGED
@@ -613,12 +613,7 @@ async function checkCode(context) {
613
613
  }
614
614
  }
615
615
 
616
- // Pattern 2: adapter = utils.Adapter() or similar
617
- if (/\badapter\s*=\s*utils\.Adapter\s*\(/i.test(line)) {
618
- return true;
619
- }
620
-
621
- // Pattern 3: extends Adapter (without utils prefix)
616
+ // Pattern 2: extends Adapter (without utils prefix)
622
617
  if (/class\s+\w+\s+extends\s+Adapter/i.test(line) && i < lineIndex) {
623
618
  // Similar brace counting logic as above
624
619
  let braceCount = 0;
@@ -696,29 +691,46 @@ async function checkCode(context) {
696
691
  continue;
697
692
  }
698
693
 
699
- // Check for this.methodName or adapter.methodName patterns
700
- const patterns = [
701
- new RegExp(`\\bthis\\.${method}\\s*\\(`, 'g'),
702
- new RegExp(`\\badapter\\.${method}\\s*\\(`, 'g'),
703
- ];
704
-
705
- for (const pattern of patterns) {
706
- if (pattern.test(line)) {
707
- // Make sure this is not a private function definition
708
- const functionDefPattern = new RegExp(
709
- `(function\\s+${method}|${method}\\s*[=:]\\s*function|${method}\\s*\\([^)]*\\)\\s*{)`,
710
- 'i',
711
- );
712
- if (!functionDefPattern.test(line)) {
713
- // Only warn if we're in an adapter class context
714
- if (isInAdapterClassContext(lines, i)) {
715
- context.warnings.push(
716
- `[W533] method "${method}()" is deprecated and will be removed with future js-controller version. Please use "set/deleteObject()" instead.`,
717
- );
718
- reportedMethods.add(method);
719
- }
694
+ // Check for this.methodName pattern
695
+ const thisPattern = new RegExp(`\\bthis\\.${method}\\s*\\(`, 'g');
696
+ // Check for adapter.methodName pattern
697
+ const adapterPattern = new RegExp(`\\badapter\\.${method}\\s*\\(`, 'g');
698
+
699
+ // Handle this.method() calls - should warn when inside adapter class context
700
+ if (thisPattern.test(line)) {
701
+ // Make sure this is not a private function definition
702
+ const functionDefPattern = new RegExp(
703
+ `(function\\s+${method}|${method}\\s*[=:]\\s*function|${method}\\s*\\([^)]*\\)\\s*{)`,
704
+ 'i',
705
+ );
706
+ if (!functionDefPattern.test(line)) {
707
+ // Only warn if we're in an adapter class context
708
+ if (isInAdapterClassContext(lines, i)) {
709
+ context.warnings.push(
710
+ `[W533] method "${method}()" is deprecated and will be removed with future js-controller version. Please use "set/deleteObject()" instead.`,
711
+ );
712
+ reportedMethods.add(method);
713
+ break; // Only warn once per line
714
+ }
715
+ }
716
+ }
717
+
718
+ // Handle adapter.method() calls - should warn when called outside of any class
719
+ if (adapterPattern.test(line)) {
720
+ // Make sure this is not a private function definition
721
+ const functionDefPattern = new RegExp(
722
+ `(function\\s+${method}|${method}\\s*[=:]\\s*function|${method}\\s*\\([^)]*\\)\\s*{)`,
723
+ 'i',
724
+ );
725
+ if (!functionDefPattern.test(line)) {
726
+ // Warn if we're NOT in an adapter class context (outside any class)
727
+ if (!isInAdapterClassContext(lines, i)) {
728
+ context.warnings.push(
729
+ `[W533] method "${method}()" is deprecated and will be removed with future js-controller version. Please use "set/deleteObject()" instead.`,
730
+ );
731
+ reportedMethods.add(method);
732
+ break; // Only warn once per line
720
733
  }
721
- break; // Only warn once per line
722
734
  }
723
735
  }
724
736
  }
@@ -92,24 +92,25 @@ async function checkGithubRepo(context) {
92
92
 
93
93
  const issues = await getAllIssues(context);
94
94
  for (const issue of issues) {
95
- if (issue.pull_request) {
96
- continue;
97
- }
95
+ // if (issue.pull_request) {
96
+ // continue;
97
+ // }
98
+ const type = issue.pull_request ? 'PR' : 'issue';
98
99
  if (issuesToWatchAsError.includes(issue.title)) {
99
100
  context.errors.push(
100
- `[E804] Please process issue [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
101
+ `[E804] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
101
102
  );
102
103
  } else if (issuesToWatchAsWarning.includes(issue.title)) {
103
104
  context.warnings.push(
104
- `[W804] Please process issue [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
105
+ `[W804] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
105
106
  );
106
107
  } else if (issue.title.startsWith('URGENT:')) {
107
108
  context.errors.push(
108
- `[E804] Please process issue [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
109
+ `[E804] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
109
110
  );
110
111
  } else if (issue.title.startsWith('IMPORTANT:')) {
111
112
  context.warnings.push(
112
- `[W804] Please process issue [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
113
+ `[W804] Please process ${type} [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
113
114
  );
114
115
  }
115
116
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.2.0",
2
+ "version": "4.2.1-alpha.0",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.17.1",