Skip to content

Commit b8206af

Browse files
nicklemgithub-actions[bot]
authored andcommitted
gpt: Automated pattern documentation updates
1 parent 0ed9532 commit b8206af

6 files changed

+126
-39
lines changed

app.log

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
2024-05-22T16:33:10.642Z [info]: Found 2 prompt templates.
2+
2024-05-22T16:33:10.649Z [info]: Found 45 documentation files.
3+
2024-05-22T16:33:10.649Z [info]: Processing pattern 1 of 45:
4+
{
5+
input__tool: 'phpmd',
6+
input__path: 'docs/description/rulesets-unusedcode.xml-UnusedPrivateMethod.md',
7+
input__patternId: 'rulesets-unusedcode.xml-UnusedPrivateMethod',
8+
input__patternDescription: '\n' +
9+
'Unused Private Method detects when a private method is declared but is unused.\n' +
10+
'\n' +
11+
'[Source](http://phpmd.org/rules/unusedcode.html#unusedprivatemethod)\n' +
12+
' '
13+
}
14+
2024-05-22T16:33:14.607Z [info]: Saving GPT-improved doc data:
15+
{
16+
title: 'Detection of Unused Private Methods',
17+
summary: 'Identifies private methods that are never invoked.',
18+
description: 'Detects private methods that are declared but not used within a class. Remove or repurpose such methods to improve code maintainability. For example:\n' +
19+
'```php\n' +
20+
'class Example {\n' +
21+
' private function unusedMethod() {\n' +
22+
' // This method is never called\n' +
23+
' }\n' +
24+
'}\n' +
25+
'```'
26+
}
27+
2024-05-22T16:33:14.608Z [info]: Processing pattern 2 of 45:
28+
{
29+
input__tool: 'phpmd',
30+
input__path: 'docs/description/rulesets-unusedcode.xml-UnusedPrivateField.md',
31+
input__patternId: 'rulesets-unusedcode.xml-UnusedPrivateField',
32+
input__patternDescription: '\n' +
33+
'Detects when a private field is declared and/or assigned a value, but not used.\n' +
34+
'\n' +
35+
'[Source](http://phpmd.org/rules/unusedcode.html#unusedprivatefield)\n' +
36+
' '
37+
}
38+
2024-05-22T16:33:22.898Z [info]: Saving GPT-improved doc data:
39+
{
40+
title: 'Detect Unused Private Fields',
41+
summary: 'Finds declared but unused private fields.',
42+
description: 'Identifies private fields declared and/or assigned values that are never used. Remove such fields to clean up the code and improve maintainability. For example:\n' +
43+
'```php\n' +
44+
'class MyClass {\n' +
45+
' private $unusedField; // Unused private field\n' +
46+
'}\n' +
47+
'```'
48+
}
49+
2024-05-22T16:33:22.898Z [info]: Processing pattern 3 of 45:
50+
{
51+
input__tool: 'phpmd',
52+
input__path: 'docs/description/rulesets-unusedcode.xml-UnusedLocalVariable.md',
53+
input__patternId: 'rulesets-unusedcode.xml-UnusedLocalVariable',
54+
input__patternDescription: '\n' +
55+
'Detects when a local variable is declared and/or assigned, but not used.\n' +
56+
'\n' +
57+
'[Source](http://phpmd.org/rules/unusedcode.html#unusedlocalvariable)\n' +
58+
' '
59+
}
60+
2024-05-22T16:33:27.012Z [info]: Saving GPT-improved doc data:
61+
{
62+
title: 'Detection of Unused Local Variables',
63+
summary: 'Finds unused local variables in PHP code.',
64+
description: 'This pattern identifies local variables that are declared and/or assigned but never used, which can signify either dead code or potential bugs. Clean up your code by removing such variables. \n' +
65+
'```php\n' +
66+
'// Issue\n' +
67+
'function example() {\n' +
68+
' $unusedVar = 42; // This variable is never used\n' +
69+
'}\n' +
70+
'\n' +
71+
'// Solution\n' +
72+
'function example() {\n' +
73+
' // Removed the unused variable\n' +
74+
'}\n' +
75+
'```'
76+
}

docs/description/description.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,20 +213,20 @@
213213
},
214214
{
215215
"patternId": "rulesets-unusedcode.xml-UnusedPrivateField",
216-
"title": "Prohibit unused private variables",
217-
"description": "Prohibit the definition or assignment of unused private variables",
216+
"title": "Detect Unused Private Fields",
217+
"description": "Finds declared but unused private fields.",
218218
"timeToFix": 5
219219
},
220220
{
221221
"patternId": "rulesets-unusedcode.xml-UnusedLocalVariable",
222-
"title": "Prohibit unused variables",
223-
"description": "Prohibit the definition or assignment of unused local variables",
222+
"title": "Detection of Unused Local Variables",
223+
"description": "Finds unused local variables in PHP code.",
224224
"timeToFix": 5
225225
},
226226
{
227227
"patternId": "rulesets-unusedcode.xml-UnusedPrivateMethod",
228-
"title": "Prohibit unused private methods",
229-
"description": "Prohibit the definition or assignment of unused private methods",
228+
"title": "Detection of Unused Private Methods",
229+
"description": "Identifies private methods that are never invoked.",
230230
"timeToFix": 5
231231
},
232232
{
@@ -362,11 +362,11 @@
362362
"timeToFix": 5
363363
},
364364
{
365-
"patternId": "rulesets-design.xml-EmptyCatchBlock",
366-
"parameters": [],
367-
"title": "Usually empty try-catch",
368-
"description": "Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution.",
369-
"timeToFix": 5
365+
"patternId": "rulesets-design.xml-EmptyCatchBlock",
366+
"parameters": [],
367+
"title": "Usually empty try-catch",
368+
"description": "Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution.",
369+
"timeToFix": 5
370370
},
371371
{
372372
"patternId": "rulesets-design.xml-CountInLoopExpression",
@@ -427,4 +427,4 @@
427427
],
428428
"timeToFix": 5
429429
}
430-
]
430+
]
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
This pattern identifies local variables that are declared and/or assigned but never used, which can signify either dead code or potential bugs. Clean up your code by removing such variables.
2+
```php
3+
// Issue
4+
function example() {
5+
$unusedVar = 42; // This variable is never used
6+
}
17

2-
Detects when a local variable is declared and/or assigned, but not used.
3-
4-
[Source](http://phpmd.org/rules/unusedcode.html#unusedlocalvariable)
5-
8+
// Solution
9+
function example() {
10+
// Removed the unused variable
11+
}
12+
```
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
2-
Detects when a private field is declared and/or assigned a value, but not used.
3-
4-
[Source](http://phpmd.org/rules/unusedcode.html#unusedprivatefield)
5-
1+
Identifies private fields declared and/or assigned values that are never used. Remove such fields to clean up the code and improve maintainability. For example:
2+
```php
3+
class MyClass {
4+
private $unusedField; // Unused private field
5+
}
6+
```
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
2-
Unused Private Method detects when a private method is declared but is unused.
3-
4-
[Source](http://phpmd.org/rules/unusedcode.html#unusedprivatemethod)
5-
1+
Detects private methods that are declared but not used within a class. Remove or repurpose such methods to improve code maintainability. For example:
2+
```php
3+
class Example {
4+
private function unusedMethod() {
5+
// This method is never called
6+
}
7+
}
8+
```

docs/patterns.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
"enabled": false
4242
},
4343
{
44-
"patternId": "rulesets-cleancode.xml-DuplicatedArrayKey",
45-
"category": "CodeStyle",
46-
"title": "Duplicated array key {0}, first declared at line {1}.",
47-
"description": "Defining another value for the same key in an array literal overrides the previous key/value, which makes it effectively an unused code. If it's known from the beginning that the key will have different value, there is usually no point in defining first one.",
48-
"level": "Info",
49-
"enabled": false
44+
"patternId": "rulesets-cleancode.xml-DuplicatedArrayKey",
45+
"category": "CodeStyle",
46+
"title": "Duplicated array key {0}, first declared at line {1}.",
47+
"description": "Defining another value for the same key in an array literal overrides the previous key/value, which makes it effectively an unused code. If it's known from the beginning that the key will have different value, there is usually no point in defining first one.",
48+
"level": "Info",
49+
"enabled": false
5050
},
5151
{
5252
"patternId": "rulesets-cleancode.xml-UndefinedVariable",
@@ -378,24 +378,24 @@
378378
{
379379
"patternId": "rulesets-unusedcode.xml-UnusedPrivateField",
380380
"category": "UnusedCode",
381-
"title": "Prohibit unused private variables",
382-
"description": "Prohibit the definition or assignment of unused private variables",
381+
"title": "Detect Unused Private Fields",
382+
"description": "Finds declared but unused private fields.",
383383
"level": "Warning",
384384
"enabled": true
385385
},
386386
{
387387
"patternId": "rulesets-unusedcode.xml-UnusedLocalVariable",
388388
"category": "UnusedCode",
389-
"title": "Prohibit unused variables",
390-
"description": "Prohibit the definition or assignment of unused local variables",
389+
"title": "Detection of Unused Local Variables",
390+
"description": "Finds unused local variables in PHP code.",
391391
"level": "Warning",
392392
"enabled": true
393393
},
394394
{
395395
"patternId": "rulesets-unusedcode.xml-UnusedPrivateMethod",
396396
"category": "UnusedCode",
397-
"title": "Prohibit unused private methods",
398-
"description": "Prohibit the definition or assignment of unused private methods",
397+
"title": "Detection of Unused Private Methods",
398+
"description": "Identifies private methods that are never invoked.",
399399
"level": "Warning",
400400
"enabled": true
401401
},
@@ -522,4 +522,4 @@
522522
"enabled": true
523523
}
524524
]
525-
}
525+
}

0 commit comments

Comments
 (0)