Merge pull request #1324 from ethereum/AdjustStaticAnalyisis

Adjusted static analysis warning notification appearance
pull/1/head
yann300 7 years ago committed by GitHub
commit 620a0fa127
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/staticanalysis/staticAnalysisView.js
  2. 4
      src/app/tabs/compile-tab.js
  3. 2
      src/app/ui/renderer.js
  4. 8
      src/app/ui/styles/renderer-styles.js
  5. 4
      test-browser/tests/staticanalysis.js

@ -90,7 +90,7 @@ staticAnalysisView.prototype.run = function () {
}
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: 'warning', useSpan: true})
self.appAPI.renderWarning(msg, warningContainer, {type: 'staticAnalysisWarning', useSpan: true})
})
})
if (warningContainer.html() === '') {

@ -124,8 +124,8 @@ module.exports = class CompileTab {
})
self._events.staticAnalysis.register('staticAnaysisWarning', (count) => {
if (count) {
const msg = `Static Analysis raised ${count} warning(s) that requires your attention.`
const settings = { type: 'warning', click: () => self._api.switchTab('staticanalysisView') }
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 }
self._opts.renderer.error(msg, self._view.errorContainer, settings)
}
})

@ -21,7 +21,7 @@ function Renderer (appAPI) {
*
* @param {String or DOMElement} message
* @param {DOMElement} container
* @param {Object} options {useSpan, noAnnotations, click:(Function), type:(warning, error), errFile, errLine, errCol}
* @param {Object} options {useSpan, noAnnotations, click:(Function), type:(warning, error, staticAnalysisWarning), errFile, errLine, errCol}
*/
Renderer.prototype.error = function (message, container, opt) {
if (!message) return

@ -6,6 +6,7 @@ var styles = styleGuide.chooser()
var css = yo`<style>
.sol.success,
.sol.error,
.sol.staticAnalysisWarning,
.sol.warning {
word-wrap: break-word;
cursor: pointer;
@ -18,6 +19,7 @@ var css = yo`<style>
.sol.success pre,
.sol.error pre,
.sol.staticAnalysisWarning pre,
.sol.warning pre {
overflow-y: hidden;
background-color: transparent;
@ -29,6 +31,7 @@ var css = yo`<style>
}
.sol.success .close,
.sol.staticAnalysisWarning .close,
.sol.error .close,
.sol.warning .close {
font-weight: bold;
@ -50,6 +53,11 @@ var css = yo`<style>
color: ${styles.rightPanel.message_Warning_Color};
}
.sol.staticAnalysisWarning {
background-color: ${styles.colors.lightViolet};
color: ${styles.colors.black};
}
.sol.success {
background-color: ${styles.rightPanel.message_Success_BackgroundColor};
border: .2em dotted ${styles.rightPanel.message_Success_BorderColor};

@ -41,11 +41,11 @@ function runTests (browser) {
browser
.click('.staticanalysisView')
.click('#staticanalysisView button')
.waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () {
.waitForElementPresent('#staticanalysisresult .staticAnalysisWarning', 2000, true, function () {
dom.listSelectorContains(['browser/Untitled.sol:2:33:Use of tx.origin',
'Fallback function of contract TooMuchGas requires too much gas',
'TooMuchGas.() : Variables have very similar names test and test1.'],
'#staticanalysisresult .warning',
'#staticanalysisresult .staticAnalysisWarning',
browser, function () {
browser.end()
}

Loading…
Cancel
Save