check if import is a library

pull/2187/head
Aniket-Engg 3 years ago committed by yann300
parent ff778f25c2
commit 7521e18f12
  1. 12
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -171,12 +171,13 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
} }
}) })
}) })
result.report.map((item) => { result.report.map(async (item) => {
let location: any = {} let location: any = {}
let locationString = 'not available' let locationString = 'not available'
let column = 0 let column = 0
let row = 0 let row = 0
let fileName = currentFile let fileName = currentFile
let isLibrary = false
if (item.location) { if (item.location) {
const split = item.location.split(':') const split = item.location.split(':')
const file = split[2] const file = split[2]
@ -195,6 +196,10 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
locationString = row + 1 + ':' + column + ':' locationString = row + 1 + ':' + column + ':'
fileName = Object.keys(lastCompilationResult.sources)[file] fileName = Object.keys(lastCompilationResult.sources)[file]
} }
if(fileName !== currentFile) {
const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName)
if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true
}
warningCount++ warningCount++
const msg = message(result.name, item.warning, item.more, fileName, locationString) const msg = message(result.name, item.warning, item.more, fileName, locationString)
const options = { const options = {
@ -202,6 +207,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
useSpan: true, useSpan: true,
errFile: fileName, errFile: fileName,
fileName, fileName,
isLibrary,
errLine: row, errLine: row,
errCol: column, errCol: column,
item: item, item: item,
@ -255,6 +261,10 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
fileName = Object.keys(lastCompilationResult.sources)[fileIndex] fileName = Object.keys(lastCompilationResult.sources)[fileIndex]
} }
} }
if(fileName !== currentFile) {
console.log('inside ------------Slither')
props.analysisModule.call('fileManager', 'getPathFromUrl', fileName).then(console.log)
}
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