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
d7a269f7
Commit
d7a269f7
authored
Jun 27, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
staticanalysis
parent
f761fd6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
27 deletions
+36
-27
app.js
src/app.js
+1
-10
righthand-panel.js
src/app/panels/righthand-panel.js
+16
-9
staticAnalysisView.js
src/app/staticanalysis/staticAnalysisView.js
+15
-6
compile-tab.js
src/app/tabs/compile-tab.js
+4
-2
No files found.
src/app.js
View file @
d7a269f7
...
...
@@ -573,16 +573,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry
.
put
({
api
:
renderer
,
name
:
'renderer'
})
// ----------------- StaticAnalysis -----------------
var
staticAnalysisAPI
=
{
renderWarning
:
(
label
,
warningContainer
,
type
)
=>
{
return
renderer
.
error
(
label
,
warningContainer
,
type
)
},
offsetToLineColumn
:
(
location
,
file
)
=>
{
return
offsetToLineColumnConverter
.
offsetToLineColumn
(
location
,
file
,
compiler
.
lastCompilationResult
)
}
}
var
staticanalysis
=
new
StaticAnalysis
(
staticAnalysisAPI
,
compiler
.
event
)
var
staticanalysis
=
new
StaticAnalysis
()
registry
.
put
({
api
:
staticanalysis
,
name
:
'staticanalysis'
})
// ---------------- Righthand-panel --------------------
...
...
src/app/panels/righthand-panel.js
View file @
d7a269f7
...
...
@@ -32,16 +32,18 @@ module.exports = class RighthandPanel {
dragbar
:
null
}
self
.
_components
.
registry
.
put
({
api
:
this
,
name
:
'righthandpanel'
})
self
.
_components
=
{
pluginManager
:
new
PluginManager
(),
tabbedMenu
:
new
TabbedMenu
(),
compile
:
new
CompileTab
(),
run
:
new
RunTab
(),
settings
:
new
SettingsTab
(),
analysis
:
new
AnalysisTab
(),
debug
:
new
DebuggerTab
(),
support
:
new
SupportTab
(),
test
:
new
TestTab
()
pluginManager
:
new
PluginManager
(
self
.
_components
.
registry
),
tabbedMenu
:
new
TabbedMenu
(
self
.
_components
.
registry
),
compile
:
new
CompileTab
(
self
.
_components
.
registry
),
run
:
new
RunTab
(
self
.
_components
.
registry
),
settings
:
new
SettingsTab
(
self
.
_components
.
registry
),
analysis
:
new
AnalysisTab
(
self
.
_components
.
registry
),
debug
:
new
DebuggerTab
(
self
.
_components
.
registry
),
support
:
new
SupportTab
(
self
.
_components
.
registry
),
test
:
new
TestTab
(
self
.
_components
.
registry
)
}
self
.
event
.
register
(
'plugin-loadRequest'
,
json
=>
{
...
...
@@ -81,6 +83,11 @@ module.exports = class RighthandPanel {
if
(
self
.
_view
.
element
)
return
self
.
_view
.
element
return
self
.
_view
.
element
}
focusOn
(
x
)
{
if
(
this
.
_components
.
tabbedMenu
)
this
.
_components
.
tabbedMenu
.
selectTabByClassName
(
x
)
}
init
()
{
// @TODO: init is for resizable drag bar only and should be refactored in the future
const
self
=
this
...
...
src/app/staticanalysis/staticAnalysisView.js
View file @
d7a269f7
...
...
@@ -9,18 +9,27 @@ var styleGuide = require('../ui/styles-guide/theme-chooser')
var
styles
=
styleGuide
.
chooser
()
var
css
=
require
(
'./styles/staticAnalysisView-styles'
)
var
globlalRegistry
=
require
(
'../../global/registry'
)
var
EventManager
=
remixLib
.
EventManager
function
staticAnalysisView
(
appAPI
,
compilerEvent
)
{
function
staticAnalysisView
(
localRegistry
)
{
var
self
=
this
this
.
event
=
new
EventManager
()
this
.
view
=
null
this
.
appAPI
=
appAPI
this
.
runner
=
new
StaticAnalysisRunner
()
this
.
modulesView
=
renderModules
(
this
.
runner
.
modules
())
this
.
lastCompilationResult
=
null
var
self
=
this
compilerEvent
.
register
(
'compilationFinished'
,
function
(
success
,
data
,
source
)
{
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globlalRegistry
// dependencies
self
.
_deps
=
{
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
renderer
:
self
.
_components
.
registry
.
get
(
'renderer'
).
api
,
offsetToLineColumnConverter
:
self
.
_components
.
registry
.
get
(
'offsetToLineColumnConverter'
).
api
}
self
.
_deps
.
compiler
.
event
.
register
(
'compilationFinished'
,
function
(
success
,
data
,
source
)
{
self
.
lastCompilationResult
=
null
$
(
'#staticanalysisresult'
).
empty
()
if
(
success
)
{
...
...
@@ -85,12 +94,12 @@ staticAnalysisView.prototype.run = function () {
start
:
parseInt
(
split
[
0
]),
length
:
parseInt
(
split
[
1
])
}
location
=
self
.
appAPI
.
offsetToLineColumn
(
location
,
file
)
location
=
self
.
_deps
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
location
,
file
)
location
=
Object
.
keys
(
self
.
lastCompilationResult
.
contracts
)[
file
]
+
':'
+
(
location
.
start
.
line
+
1
)
+
':'
+
(
location
.
start
.
column
+
1
)
+
':'
}
warningCount
++
var
msg
=
yo
`<span>
${
location
}
${
item
.
warning
}
${
item
.
more
?
yo
`<span><br><a href="
${
item
.
more
}
" target="blank">more</a></span>`
:
yo
`<span></span>`
}
</span>`
self
.
appAPI
.
renderWarning
(
msg
,
warningContainer
,
{
type
:
'staticAnalysisWarning'
,
useSpan
:
true
})
self
.
_deps
.
renderer
.
error
(
msg
,
warningContainer
,
{
type
:
'staticAnalysisWarning'
,
useSpan
:
true
})
})
})
if
(
warningContainer
.
html
()
===
''
)
{
...
...
src/app/tabs/compile-tab.js
View file @
d7a269f7
...
...
@@ -40,7 +40,9 @@ module.exports = class CompileTab {
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
staticAnalysis
:
self
.
_components
.
registry
.
get
(
'staticanalysis'
).
api
,
renderer
:
self
.
_components
.
registry
.
get
(
'renderer'
).
api
,
transactionContextAPI
:
self
.
_components
.
registry
.
get
(
'transactionContextAPI'
).
api
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
transactionContextAPI
:
self
.
_components
.
registry
.
get
(
'transactionContextAPI'
).
api
,
rightHandPanel
:
self
.
_components
.
registry
.
get
(
'righthandpanel'
).
api
}
self
.
data
=
{
hideWarnings
:
self
.
_deps
.
config
.
get
(
'hideWarnings'
)
||
false
,
...
...
@@ -148,7 +150,7 @@ module.exports = class CompileTab {
self
.
_deps
.
staticAnalysis
.
event
.
register
(
'staticAnaysisWarning'
,
(
count
)
=>
{
if
(
count
)
{
const
msg
=
`Static Analysis raised
${
count
}
warning(s) that requires your attention. Click here to show the warning(s).`
const
settings
=
{
type
:
'staticAnalysisWarning'
,
click
:
()
=>
self
.
_
api
.
switchTab
(
'staticanalysisView'
),
useSpan
:
true
}
const
settings
=
{
type
:
'staticAnalysisWarning'
,
click
:
()
=>
self
.
_
deps
.
rightHandPanel
.
focusOn
(
'staticanalysisView'
),
useSpan
:
true
}
self
.
_deps
.
renderer
.
error
(
msg
,
self
.
_view
.
errorContainer
,
settings
)
}
})
...
...
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