linting fixed for remix-analyzer

pull/5370/head
lianahus 7 months ago
parent 23a1a70401
commit 98cd641e12
  1. 11
      libs/remix-analyzer/test/analysis/staticAnalysisCommon-test.ts
  2. 3
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
  3. 4
      libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
  4. 2
      libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts

@ -1,4 +1,4 @@
import { default as test} from "tape" import { default as test } from "tape"
import * as common from '../../src/solidity-analyzer/modules/staticAnalysisCommon' import * as common from '../../src/solidity-analyzer/modules/staticAnalysisCommon'
const { localCall, thisLocalCall, libCall, externalDirect, superLocal, assignment, abiNamespaceCallNodes, const { localCall, thisLocalCall, libCall, externalDirect, superLocal, assignment, abiNamespaceCallNodes,
inlineAssembly, unaryOperation, nowAst, blockTimestamp, stateVariableContractNode, inlineAssembly, unaryOperation, nowAst, blockTimestamp, stateVariableContractNode,
@ -6,7 +6,6 @@ const { localCall, thisLocalCall, libCall, externalDirect, superLocal, assignmen
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
lowlevelCall, parameterFunction, parameterFunctionCall, inheritance, blockHashAccess, contractDefinition, funcDefForComplexParams } = require('./astBlocks') lowlevelCall, parameterFunction, parameterFunctionCall, inheritance, blockHashAccess, contractDefinition, funcDefForComplexParams } = require('./astBlocks')
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const compiledContractObj = require('./compilationDetails/CompiledContractObj.json') const compiledContractObj = require('./compilationDetails/CompiledContractObj.json')
function escapeRegExp (str) { function escapeRegExp (str) {
@ -89,7 +88,7 @@ test('staticAnalysisCommon.helpers.operator', function (t) {
test('staticAnalysisCommon.helpers.nodeType', function (t) { test('staticAnalysisCommon.helpers.nodeType', function (t) {
t.plan(3) t.plan(3)
const node = { nodeType: 'Identifier', name: 'now'} const node = { nodeType: 'Identifier', name: 'now' }
const node2 = { nodeType: 'FunctionCall', memberName: 'call' } const node2 = { nodeType: 'FunctionCall', memberName: 'call' }
t.ok(common.helpers.nodeType(node, common.nodeTypes.IDENTIFIER), 'should work for identifier') t.ok(common.helpers.nodeType(node, common.nodeTypes.IDENTIFIER), 'should work for identifier')
@ -140,7 +139,7 @@ test('staticAnalysisCommon.helpers.expressionTypeDescription', function (t) {
test('staticAnalysisCommon.getType', function (t) { test('staticAnalysisCommon.getType', function (t) {
t.plan(3) t.plan(3)
const node = { "argumentTypes": null, const node = { "argumentTypes": null,
"id": 3, "id": 3,
"name": "a", "name": "a",
"nodeType": "Identifier", "nodeType": "Identifier",
@ -357,9 +356,9 @@ test('staticAnalysisCommon.isStateVariable', function (t) {
test('staticAnalysisCommon.isConstantFunction', function (t) { test('staticAnalysisCommon.isConstantFunction', function (t) {
t.plan(3) t.plan(3)
t.ok(common.isConstantFunction(functionDefinition), 'should be const func definition') t.ok(common.isConstantFunction(functionDefinition), 'should be const func definition')
functionDefinition.stateMutability = 'view' functionDefinition.stateMutability = 'view'
t.ok(common.isConstantFunction(functionDefinition), 'should be const func definition') t.ok(common.isConstantFunction(functionDefinition), 'should be const func definition')
functionDefinition.stateMutability = 'nonpayable' functionDefinition.stateMutability = 'nonpayable'
t.notOk(common.isConstantFunction(functionDefinition), 'should not be const func definition') t.notOk(common.isConstantFunction(functionDefinition), 'should not be const func definition')
}) })

@ -53,9 +53,6 @@ test('setup', function (t) {
}) })
}); });
test('Integration test thisLocal module', function (t: test.Test) { test('Integration test thisLocal module', function (t: test.Test) {
t.plan(testFiles.length) t.plan(testFiles.length)
const module: any = modules.thisLocal const module: any = modules.thisLocal

@ -31,9 +31,9 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
const statRunner: StatRunner = new StatRunner() const statRunner: StatRunner = new StatRunner()
t.doesNotThrow(() => { t.doesNotThrow(() => {
statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module()}]) statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }])
}, 'Analysis should not throw') }, 'Analysis should not throw')
const reports = statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module()}]) const reports = statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }])
t.ok(!reports.some((mod: AnalysisReport) => mod.report.some((rep: AnalysisReportObj) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors')) t.ok(!reports.some((mod: AnalysisReport) => mod.report.some((rep: AnalysisReportObj) => rep.warning.includes('INTERNAL ERROR')), 'Should not have internal errors'))
}) })

@ -6,7 +6,7 @@ import { default as StatRunner } from '../../src/solidity-analyzer'
import solc from 'solc'; import solc from 'solc';
import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types' import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types'
import { checksEffectsInteraction } from '../../src/solidity-analyzer/modules/' import { checksEffectsInteraction } from '../../src/solidity-analyzer/modules/'
const {compilerInput } = helpers.compiler const { compilerInput } = helpers.compiler
const folder: string = 'solidity-v0.5' const folder: string = 'solidity-v0.5'
let compiler let compiler

Loading…
Cancel
Save