location only for non-imported contracts

pull/1398/head
Aniket-Engg 4 years ago committed by Aniket
parent 33b334eabc
commit 4b83cb4fee
  1. 47
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -197,30 +197,31 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
props.analysisModule.call('terminal', 'log', { type: 'info', value: `[Slither Analysis]: Analysis Completed!! ${result.count} warnings found.` }) props.analysisModule.call('terminal', 'log', { type: 'info', value: `[Slither Analysis]: Analysis Completed!! ${result.count} warnings found.` })
const report = result.data const report = result.data
report.map((item) => { report.map((item) => {
const location: any = {} let location: any = {}
const locationString = 'not available' let locationString = 'not available'
const column = 0 let column = 0
const row = 0 let row = 0
const fileName = currentFile let fileName = currentFile
// There are issues with location for imported contract
// which stops complete analysis including remix analyzer's
// if (item.sourceMap && item.sourceMap.length) { if (item.sourceMap && item.sourceMap.length) {
// location = { const fileIndex = Object.keys(lastCompilationResult.sources).indexOf(item.sourceMap[0].source_mapping.filename_relative)
// start: item.sourceMap[0].source_mapping.start, if(fileIndex >=0 ) {
// length: item.sourceMap[0].source_mapping.length location = {
// } start: item.sourceMap[0].source_mapping.start,
// location = props.analysisModule._deps.offsetToLineColumnConverter.offsetToLineColumn( length: item.sourceMap[0].source_mapping.length
// location, }
// Object.keys(lastCompilationResult.sources).indexOf(item.sourceMap[0].source_mapping.filename_relative), location = props.analysisModule._deps.offsetToLineColumnConverter.offsetToLineColumn(
// lastCompilationSource.sources, location,
// lastCompilationResult.sources fileIndex,
// ) lastCompilationSource.sources,
// row = location.start.line lastCompilationResult.sources
// column = location.start.column )
// locationString = row + 1 + ':' + column + ':' row = location.start.line
// fileName = Object.keys(lastCompilationResult.contracts)[0] column = location.start.column
// } locationString = row + 1 + ':' + column + ':'
fileName = Object.keys(lastCompilationResult.sources)[fileIndex]
}
}
warningCount++ warningCount++
const msg = message(item.title, item.description, item.more, fileName, locationString) const msg = message(item.title, item.description, item.more, fileName, locationString)
const options = { const options = {

Loading…
Cancel
Save