show lines for gas warnings

pull/4950/head^2
aniket-engg 7 months ago committed by Aniket
parent cd13058458
commit 6fb997c49e
  1. 13
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx
  2. 2
      libs/remix-ui/solidity-compiler/src/lib/solScanTable.tsx
  3. 2
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts

@ -313,8 +313,19 @@ export const ContractSelection = (props: ContractSelectionProps) => {
const { data: scanData } = await axios.post('https://solidityscan.remixproject.org/downloadResult', { url })
const scanReport: ScanReport = scanData.scan_report
if (scanReport?.multi_file_scan_details?.length) {
for (const template of scanReport.multi_file_scan_details) {
if (template.metric_wise_aggregated_findings?.length) {
const { metric_wise_aggregated_findings } = template
let positions = []
for (const details of metric_wise_aggregated_findings) {
const { findings } = details
for (const f of findings)
positions.push(`${f.line_nos_start[0]}:${f.line_nos_end[0]}`)
}
template.positions = JSON.stringify(positions)
}
}
await plugin.call('terminal', 'logHtml', <SolScanTable scanReport={scanReport} fileName={fileName}/>)
} else {
const modal: AppModal = {

@ -37,7 +37,7 @@ export function SolScanTable(props: SolScanTableProps) {
<td scope="col">{template.template_details.issue_name}</td>
<td scope="col">{template.template_details.issue_severity}</td>
<td scope="col">{template.template_details.issue_confidence}</td>
<td scope="col">{parse(template.template_details.static_issue_description)}</td>
<td scope="col">{parse(template.template_details.static_issue_description)} {template.positions ? `Lines: ${template.positions}`: ''}</td>
<td scope="col">{template.template_details.issue_remediation ? parse(template.template_details.issue_remediation) : 'Not Available' }</td>
</tr>
)

@ -19,6 +19,8 @@ export interface ScanTemplate {
export interface ScanDetails {
issue_id: string
no_of_findings: string
metric_wise_aggregated_findings?: Record<string, any>[]
positions?: string
template_details: ScanTemplate
}

Loading…
Cancel
Save