linting fixed for remix-analyzer

pull/4771/head
lianahus 7 months ago
parent 4ecaca9218
commit f5cdc389a7
  1. 11
      libs/remix-analyzer/test/analysis/staticAnalysisCommon-test.ts
  2. 4
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
  3. 3
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
  4. 6
      libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
  5. 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'
const { localCall, thisLocalCall, libCall, externalDirect, superLocal, assignment, abiNamespaceCallNodes,
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
lowlevelCall, parameterFunction, parameterFunctionCall, inheritance, blockHashAccess, contractDefinition, funcDefForComplexParams } = require('./astBlocks')
// eslint-disable-next-line @typescript-eslint/no-var-requires
const compiledContractObj = require('./compilationDetails/CompiledContractObj.json')
function escapeRegExp (str) {
@ -89,7 +88,7 @@ test('staticAnalysisCommon.helpers.operator', function (t) {
test('staticAnalysisCommon.helpers.nodeType', function (t) {
t.plan(3)
const node = { nodeType: 'Identifier', name: 'now'}
const node = { nodeType: 'Identifier', name: 'now' }
const node2 = { nodeType: 'FunctionCall', memberName: 'call' }
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) {
t.plan(3)
const node = { "argumentTypes": null,
const node = { "argumentTypes": null,
"id": 3,
"name": "a",
"nodeType": "Identifier",
@ -357,9 +356,9 @@ test('staticAnalysisCommon.isStateVariable', function (t) {
test('staticAnalysisCommon.isConstantFunction', function (t) {
t.plan(3)
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')
functionDefinition.stateMutability = 'nonpayable'
functionDefinition.stateMutability = 'nonpayable'
t.notOk(common.isConstantFunction(functionDefinition), 'should not be const func definition')
})

@ -46,7 +46,7 @@ test('setup', function (t: test.Test) {
testFiles.forEach((fileName) => {
const content: string = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
// Latest AST is available under 'compileStandardWrapper' under solc for, 0.4.12 <= version < 0.5.0
// Latest AST is available under 'compileStandardWrapper' under solc for, 0.4.12 <= version < 0.5.0
compilationResults[fileName] = JSON.parse(compiler.compile(compilerInput(content)))
})
@ -820,5 +820,5 @@ function runModuleOnFiles (Module: any, t: test.Test, cb: ((fname: string, repor
t.comment('Error while executing Module: ' + JSON.stringify(report))
}
cb(fileName, report)
})
})
}

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

@ -29,11 +29,11 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
const res: CompilationResult = compile('functionParameters.sol')
const Module: any = checksEffectsInteraction
const statRunner: StatRunner = new StatRunner()
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')
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'))
})

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

Loading…
Cancel
Save