You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/analyze.go
+15-71Lines changed: 15 additions & 71 deletions
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,21 @@ package cmd
2
2
3
3
import (
4
4
"codacy/cli-v2/config"
5
+
"codacy/cli-v2/domain"
5
6
"codacy/cli-v2/plugins"
6
7
"codacy/cli-v2/tools"
7
8
"codacy/cli-v2/tools/lizard"
8
9
"encoding/json"
9
10
"fmt"
10
-
"io"
11
11
"log"
12
-
"net/http"
13
12
"os"
14
13
"path/filepath"
15
14
"strings"
16
15
17
16
"codacy/cli-v2/utils"
18
17
18
+
codacyclient "codacy/cli-v2/codacy-client"
19
+
19
20
"github.com/spf13/cobra"
20
21
"gopkg.in/yaml.v3"
21
22
)
@@ -210,21 +211,6 @@ type CodacyIssue struct {
210
211
Categorystring`json:"category"`
211
212
}
212
213
213
-
typeToolstruct {
214
-
UUIDstring`json:"uuid"`
215
-
ShortNamestring`json:"shortName"`
216
-
Prefixstring`json:"prefix"`
217
-
}
218
-
219
-
typePatternstruct {
220
-
UUIDstring`json:"uuid"`
221
-
IDstring`json:"id"`
222
-
Namestring`json:"name"`
223
-
Categorystring`json:"category"`
224
-
Descriptionstring`json:"description"`
225
-
Levelstring`json:"level"`
226
-
}
227
-
228
214
funcinit() {
229
215
analyzeCmd.Flags().StringVarP(&outputFile, "output", "o", "", "Output file for analysis results")
230
216
analyzeCmd.Flags().StringVarP(&toolsToAnalyzeParam, "tool", "t", "", "Which tool to run analysis with. If not specified, all configured tools will be run")
"text": "Method has extremely high cyclomatic complexity"
15
+
"text": "Checks if the cyclomatic complexity of a function or logic block exceeds the medium threshold (default is 8)."
16
16
},
17
17
"properties": {
18
18
"tags": [
19
-
"critical"
19
+
"warning"
20
20
]
21
21
}
22
22
},
23
23
{
24
-
"id": "Lizard_ccn-minor",
24
+
"id": "Lizard_file-nloc-medium",
25
25
"shortDescription": {
26
-
"text": "Method has high cyclomatic complexity"
26
+
"text": "This rule checks if the number of lines of code (excluding comments) in a file exceeds a medium threshold, typically 500 lines."
27
27
},
28
28
"properties": {
29
29
"tags": [
30
-
"minor"
30
+
"warning"
31
31
]
32
32
}
33
33
},
34
34
{
35
35
"id": "Lizard_nloc-medium",
36
36
"shortDescription": {
37
-
"text": "Method has too many lines of code"
37
+
"text": "Checks if the number of lines of code (excluding comments) in a function exceeds a medium threshold (default 50 lines)."
38
38
},
39
39
"properties": {
40
40
"tags": [
41
-
"medium"
41
+
"warning"
42
42
]
43
43
}
44
44
},
45
45
{
46
-
"id": "Lizard_nloc-minor",
46
+
"id": "Lizard_parameter-count-medium",
47
47
"shortDescription": {
48
-
"text": "Method has too many lines of code"
48
+
"text": "This rule checks the number of parameters passed to a function and raises an issue if it exceeds a medium threshold, which by default is 8 parameters."
49
49
},
50
50
"properties": {
51
51
"tags": [
52
-
"minor"
52
+
"warning"
53
53
]
54
54
}
55
55
}
@@ -59,9 +59,9 @@
59
59
"results": [
60
60
{
61
61
"ruleId": "Lizard_nloc-medium",
62
-
"level": "medium",
62
+
"level": "warning",
63
63
"message": {
64
-
"text": "Method complex_analysis has 65 lines of code (limit is 25)"
64
+
"text": "Method complex_analysis has 65 lines of code (limit is 50)"
65
65
},
66
66
"locations": [
67
67
{
@@ -78,10 +78,10 @@
78
78
]
79
79
},
80
80
{
81
-
"ruleId": "Lizard_ccn-critical",
82
-
"level": "critical",
81
+
"ruleId": "Lizard_ccn-medium",
82
+
"level": "warning",
83
83
"message": {
84
-
"text": "Method complex_analysis has a cyclomatic complexity of 31 (limit is 30)"
84
+
"text": "Method complex_analysis has a cyclomatic complexity of 31 (limit is 8)"
0 commit comments