Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
493511fe
Commit
493511fe
authored
Apr 19, 2021
by
tizah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix failing test
parent
e6ae1d35
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
remix-ui-static-analyser.tsx
...x-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+12
-5
No files found.
libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
View file @
493511fe
...
@@ -81,20 +81,25 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
...
@@ -81,20 +81,25 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const
[
warningState
,
setWarningState
]
=
useState
([])
const
[
warningState
,
setWarningState
]
=
useState
([])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
autoRun
)
{
if
(
autoRun
)
{
const
setCompilationResult
=
async
(
data
,
source
,
file
)
=>
{
const
setCompilationResult
=
async
(
data
,
source
,
file
)
=>
{
await
setResult
({
lastCompilationResult
:
data
,
lastCompilationSource
:
source
,
currentFile
:
file
})
await
setResult
({
lastCompilationResult
:
data
,
lastCompilationSource
:
source
,
currentFile
:
file
})
}
}
if
(
props
.
analysisModule
)
{
if
(
props
.
analysisModule
)
{
props
.
analysisModule
.
on
(
props
.
analysisModule
.
on
(
'solidity'
,
'solidity'
,
'compilationFinished'
,
'compilationFinished'
,
(
file
,
source
,
languageVersion
,
data
)
=>
{
(
file
,
source
,
languageVersion
,
data
)
=>
{
if
(
languageVersion
.
indexOf
(
'soljson'
)
!==
0
)
return
if
(
languageVersion
.
indexOf
(
'soljson'
)
!==
0
)
return
setCompilationResult
(
data
,
source
,
file
)
setCompilationResult
(
data
,
source
,
file
)
if
(
categoryIndex
.
length
>
0
){
run
(
data
,
source
,
file
)
run
(
data
,
source
,
file
)
}
}
}
)
)
}
}
}
else
{
}
else
{
...
@@ -102,7 +107,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
...
@@ -102,7 +107,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
}
return
()
=>
{
}
return
()
=>
{
}
},
[
autoRun
])
},
[
autoRun
,
categoryIndex
])
const
run
=
(
lastCompilationResult
,
lastCompilationSource
,
currentFile
)
=>
{
const
run
=
(
lastCompilationResult
,
lastCompilationSource
,
currentFile
)
=>
{
// const highlightLocation = async (location, fileName) => {
// const highlightLocation = async (location, fileName) => {
...
@@ -197,8 +202,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
...
@@ -197,8 +202,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const
groupedCategory
=
groupBy
(
resultArray
,
'warningModuleName'
)
const
groupedCategory
=
groupBy
(
resultArray
,
'warningModuleName'
)
setWarningState
(
groupedCategory
)
setWarningState
(
groupedCategory
)
})
})
if
(
categoryIndex
.
length
>
0
){
props
.
event
.
trigger
(
'staticAnaysisWarning'
,
[
warningCount
])
props
.
event
.
trigger
(
'staticAnaysisWarning'
,
[
warningCount
])
}
}
else
{
}
else
{
setRunButtonState
(
true
)
setRunButtonState
(
true
)
if
(
categoryIndex
.
length
)
{
if
(
categoryIndex
.
length
)
{
...
@@ -217,8 +223,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
...
@@ -217,8 +223,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
})
})
)
)
}
else
{
}
else
{
setCategoryIndex
(
_
.
uniq
([...
categoryIndex
,
...
index
]))
setCategoryIndex
(
_
.
uniq
([...
categoryIndex
]))
}
}
}
}
const
handleCheckOrUncheckCategory
=
(
category
)
=>
{
const
handleCheckOrUncheckCategory
=
(
category
)
=>
{
...
@@ -353,9 +360,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
...
@@ -353,9 +360,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
{
result
.
currentFile
&&
result
.
currentFile
}
{
result
.
currentFile
&&
result
.
currentFile
}
</
span
>
</
span
>
</
div
>
</
div
>
{
Object
.
entries
(
warningState
).
length
>
0
&&
{
categoryIndex
.
length
>
0
&&
Object
.
entries
(
warningState
).
length
>
0
&&
<
div
id=
'staticanalysisresult'
>
<
div
id=
'staticanalysisresult'
>
<
div
className=
"mb-4
warning
"
>
<
div
className=
"mb-4"
>
{
{
(
Object
.
entries
(
warningState
).
map
((
element
)
=>
(
(
Object
.
entries
(
warningState
).
map
((
element
)
=>
(
<>
<>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment