diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js
index 56cd59015f..683318f484 100644
--- a/src/app/panels/tab-proxy.js
+++ b/src/app/panels/tab-proxy.js
@@ -189,7 +189,7 @@ export class TabProxy {
// @todo(#2492) remove style after the mainPanel layout fix.
this._view.tabs = yo`
-
+
${zoomBtns}
${this._view.filetabs}
diff --git a/src/app/tabs/staticanalysis/staticAnalysisView.js b/src/app/tabs/staticanalysis/staticAnalysisView.js
index e0b0e398c5..993a330ba0 100644
--- a/src/app/tabs/staticanalysis/staticAnalysisView.js
+++ b/src/app/tabs/staticanalysis/staticAnalysisView.js
@@ -113,10 +113,33 @@ staticAnalysisView.prototype.run = function () {
if (this.lastCompilationResult && selected.length) {
this.runBtn.removeAttribute('disabled')
let warningCount = 0
- this.runner.run(this.lastCompilationResult, selected, function (results) {
- results.map(function (result, i) {
- result.report.map(function (item, i) {
+ this.runner.run(this.lastCompilationResult, selected, (results) => {
+ const groupedModules = utils.groupBy(preProcessModules(this.runner.modules()), 'categoryId')
+ results.map((result, j) => {
+ let moduleName
+ Object.keys(groupedModules).map((key) => {
+ groupedModules[key].forEach((el) => {
+ if (el.name === result.name) {
+ moduleName = groupedModules[key][0].categoryDisplayName
+ return
+ }
+ })
+ })
+ let alreadyExistedEl = this.view.querySelector(`[id="staticAnalysisModule${moduleName}"]`)
+ if (!alreadyExistedEl) {
+ warningContainer.append(`
+
+ ${moduleName}
+
+ `)
+ }
+
+ result.report.map((item, i) => {
let location = ''
+ let locationString = 'not available'
+ let column = 0
+ let row = 0
+ let fileName = this.currentFile
if (item.location) {
var split = item.location.split(':')
var file = split[2]
@@ -127,14 +150,38 @@ staticAnalysisView.prototype.run = function () {
location = self._deps.offsetToLineColumnConverter.offsetToLineColumn(location,
parseInt(file),
self.lastCompilationSource.sources,
- self.lastCompilationResult.sources)
- location = Object.keys(self.lastCompilationResult.contracts)[file] + ':' + (location.start.line + 1) + ':' + (location.start.column + 1) + ':'
+ self.lastCompilationResult.sources
+ )
+ row = location.start.line + 1
+ column = location.start.column + 1
+ locationString = row + ':' + column + ':'
+ fileName = Object.keys(self.lastCompilationResult.contracts)[file]
}
warningCount++
- const msg = yo`
${result.name} ${location} ${item.warning} ${item.more ? yo`
more` : yo``}`
- self._components.renderer.error(msg, warningContainer, {type: 'staticAnalysisWarning alert alert-warning', useSpan: true})
+ const msg = yo`
+
+ ${result.name}
+ ${item.warning}
+ ${item.more ? yo`more` : yo``}
+ Pos: ${locationString}
+ `
+ self._components.renderer.error(
+ msg,
+ this.view.querySelector(`[id="staticAnalysisModule${moduleName}"]`),
+ {
+ type: 'staticAnalysisWarning mx-2 alert alert-warning',
+ useSpan: true,
+ errFile: fileName,
+ errLine: row,
+ errCol: column
+ }
+ )
})
})
+ // hide empty staticAnalysisModules sections
+ this.view.querySelectorAll('[name="staticAnalysisModules"]').forEach((section) => {
+ if (!section.getElementsByClassName('alert-warning').length) section.hidden = true
+ })
self.event.trigger('staticAnaysisWarning', [warningCount])
})
} else {
@@ -206,7 +253,7 @@ staticAnalysisView.prototype.renderModules = function () {
return yo`
this.handleCollapse(e)}"/>
-