FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
OneScript/verify_stylecode.ps1 at develop · Asmody/OneScript · GitHub
Asmody
/
OneScript
Public
forked from
EvilBeaver/OneScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
OneScript
/
verify_stylecode.ps1
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (49 loc) · 1.72 KB
Breadcrumbs
OneScript
/
verify_stylecode.ps1
Copy path
File metadata and controls
60 lines (49 loc) · 1.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Param
(
[
int
]
$level
=
1
,
[
string
]
$output
,
[
string
]
$projects
=
"
ScriptEngine;oscript;ScriptEngine.HostedScript;TestApp
"
)
$InspectCodeToolPath
=
"
JetBrains.ReSharper.CommandLineTools\inspectcode.exe
"
$categories
=
@
(
"
CodeStyleIssues
"
,
"
ConstraintViolation
"
)
$levels
=
@
{
"
SUGGESTION
"
=
1
;
"
WARNING
"
=
2
;
"
ERROR
"
=
3
;
}
$logFile
=
"
codestyle.log
"
&
"
$
(
$InspectCodeToolPath
)
"
--
toolset
=
12.0
--
output
=
$logFile
--
project
=
"
$
(
$projects
)
"
src\1Script.sln
|
Out-Null
Write-Host
"
Analysis Completed
"
-
Foreground Green
#
Parse report
[
xml
]
$reportXml
=
Get-Content
$logFile
$report
=
$reportXml
.Report
$codeStyleIssueTypes
=
@
{}
foreach
(
$issueType
in
$report
.IssueTypes.IssueType
) {
if
(
-not
(
$categories
-contains
$issueType
.CategoryId
)) {
continue
}
$codeStyleIssueTypes
.Add
(
$issueType
.Id
,
$issueType
)
}
foreach
(
$project
in
$report
.Issues.Project
) {
foreach
(
$issue
in
$project
.Issue
) {
if
(
-not
$codeStyleIssueTypes
.ContainsKey
(
$issue
.TypeId
)) {
continue
}
$type
=
$codeStyleIssueTypes
[
$issue
.TypeId
]
if
(
$levels
[
$type
.Severity
]
-lt
$level
) {
continue
}
$message
=
"
[
$
(
$type
.Severity
)
]
$
(
$issue
.File
)
:
$
(
$issue
.Line
)
`"
$
(
$issue
.Message
)
`"
"
$color
=
"
White
"
switch
(
$levels
[
$type
.Severity
]) {
1
{
$color
=
"
Green
"
}
2
{
$color
=
"
Yellow
"
}
3
{
$color
=
"
Red
"
}
}
if
(
-not
[
string
]::IsNullOrEmpty(
$output
)) {
$message
|
Out-File
$output
-
Append
}
else
{
Write-Host
$message
-
Foreground
$color
}
}
}
Back
|
FazBrowse Home
|
New Git URL