Skip to content

Commit 23e6620

Browse files
committed
clean up as per @Aniket-Engg
1 parent b6a0b02 commit 23e6620

File tree

3 files changed

+25
-30
lines changed

3 files changed

+25
-30
lines changed

libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { CustomTooltip } from "@remix-ui/helper";
1+
import { CustomTooltip } from "@remix-ui/helper"
22
import React from "react"; //eslint-disable-line
3-
import { RemixUiStaticAnalyserState } from "../staticanalyser";
3+
import { RemixUiStaticAnalyserState } from "../staticanalyser"
44

55
interface ErrorRendererProps {
66
message: any;
@@ -13,45 +13,45 @@ interface ErrorRendererProps {
1313

1414
const ErrorRenderer = ({ message, opt, editor, name, ssaState }: ErrorRendererProps) => {
1515
const getPositionDetails = (msg: any) => {
16-
const result = {} as Record<string, number | string>;
16+
const result = {} as Record<string, number | string>
1717

1818
// To handle some compiler warning without location like SPDX license warning etc
19-
if (!msg.includes(":")) return { errLine: -1, errCol: -1, errFile: msg };
19+
if (!msg.includes(":")) return { errLine: -1, errCol: -1, errFile: msg }
2020

2121
// extract line / column
22-
let position = msg.match(/^(.*?):([0-9]*?):([0-9]*?)?/);
23-
result.errLine = position ? parseInt(position[2]) - 1 : -1;
24-
result.errCol = position ? parseInt(position[3]) : -1;
22+
let position = msg.match(/^(.*?):([0-9]*?):([0-9]*?)?/)
23+
result.errLine = position ? parseInt(position[2]) - 1 : -1
24+
result.errCol = position ? parseInt(position[3]) : -1
2525

2626
// extract file
27-
position = msg.match(/^(https:.*?|http:.*?|.*?):/);
28-
result.errFile = position ? position[1] : "";
27+
position = msg.match(/^(https:.*?|http:.*?|.*?):/)
28+
result.errFile = position ? position[1] : ""
2929
return result;
30-
};
30+
}
3131

3232
const handlePointToErrorOnClick = async (location, fileName) => {
33-
await editor.call("editor", "discardHighlight");
33+
await editor.call("editor", "discardHighlight")
3434
await editor.call("editor", "highlight", location, fileName, "", {
3535
focus: true,
36-
});
37-
};
36+
})
37+
}
3838

39-
if (!message) return;
40-
let position = getPositionDetails(message);
39+
if (!message) return
40+
let position = getPositionDetails(message)
4141
if (
4242
!position.errFile ||
4343
(opt.errorType && opt.errorType === position.errFile)
4444
) {
4545
// Updated error reported includes '-->' before file details
46-
const errorDetails = message.split("-->");
46+
const errorDetails = message.split("-->")
4747
// errorDetails[1] will have file details
48-
if (errorDetails.length > 1) position = getPositionDetails(errorDetails[1]);
48+
if (errorDetails.length > 1) position = getPositionDetails(errorDetails[1])
4949
}
50-
opt.errLine = position.errLine;
51-
opt.errCol = position.errCol;
52-
opt.errFile = position.errFile.trim();
50+
opt.errLine = position.errLine
51+
opt.errCol = position.errCol
52+
opt.errFile = position.errFile.trim()
5353
const classList =
54-
opt.type === "error" ? "alert alert-danger" : "alert alert-warning";
54+
opt.type === "error" ? "alert alert-danger" : "alert alert-warning"
5555
return (
5656
<div>
5757
<div className={`sol ${opt.type} ${classList}`}>
@@ -91,7 +91,7 @@ const ErrorRenderer = ({ message, opt, editor, name, ssaState }: ErrorRendererPr
9191
</div>
9292
</div>
9393
</div>
94-
);
95-
};
94+
)
95+
}
9696

97-
export default ErrorRenderer;
97+
export default ErrorRenderer

libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<b
207207
props.analysisModule.call('terminal', 'log', { type: 'error', value: '[Slither Analysis]: Error occured! See remixd console for details.' })
208208
showWarnings(warningMessage, 'warningModuleName')
209209
}
210-
} else //showWarnings(warningMessage, 'warningModuleName')
211-
setStartAnalysis(false)
210+
} else setStartAnalysis(false)
212211
} else {
213212
if (categoryIndex.length) {
214213
warningContainer.current.innerText = 'No compiled AST available'

libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,6 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
528528
])
529529
}, [solhintEnabled, basicEnabled, slitherEnabled, showSlither])
530530

531-
useEffect(() => {
532-
533-
}, [])
534-
535531
const handleSlitherEnabled = async () => {
536532
const checkRemixd = await props.analysisModule.call(
537533
"manager",

0 commit comments

Comments
 (0)