updates for analyzer

fixAnalyzerTest
aniket-engg 4 years ago
parent 40fd06fd16
commit 8cd8a00827
  1. 1
      libs/remix-analyzer/index.ts
  2. 1
      libs/remix-analyzer/src/index.ts
  3. 4
      libs/remix-analyzer/src/solidity-analyzer/modules/abstractAstView.ts
  4. 2
      libs/remix-analyzer/src/solidity-analyzer/modules/functionCallGraph.ts
  5. 2
      libs/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts
  6. 2
      libs/remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
  7. 6
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
  8. 8
      libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
  9. 6
      libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
  10. 6
      libs/remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
  11. 7
      libs/remix-analyzer/tsconfig.lib.json
  12. 7
      libs/remix-astwalker/tsconfig.lib.json
  13. 2982
      package-lock.json
  14. 3
      package.json
  15. 4
      workspace.json

@ -1 +0,0 @@
export { default as CodeAnalysis} from './src/solidity-analyzer'

@ -0,0 +1 @@
export { default as CodeAnalysis} from './solidity-analyzer'

@ -1,8 +1,8 @@
import { getStateVariableDeclarationsFromContractNode, getInheritsFromName, getContractName,
getFunctionOrModifierDefinitionParameterPart, getType, getDeclaredVariableName, getFunctionDefinitionReturnParameterPart } from './staticAnalysisCommon'
import { AstWalker } from 'remix-astwalker'
import { AstWalker } from '@remix-project/remix-astwalker'
import { FunctionDefinitionAstNode, ParameterListAstNode, ModifierDefinitionAstNode, ContractHLAst, VariableDeclarationAstNode,
FunctionHLAst, ReportObj, ReportFunction, VisitFunction, ModifierHLAst, CompilationResult } from 'types'
FunctionHLAst, ReportObj, ReportFunction, VisitFunction, ModifierHLAst, CompilationResult } from '../../types'
type WrapFunction = ((contracts: ContractHLAst[], isSameName: boolean) => ReportObj[])

@ -1,6 +1,6 @@
'use strict'
import { FunctionHLAst, ContractHLAst, FunctionCallGraph, ContractCallGraph, Context, FunctionCallAstNode } from "types"
import { FunctionHLAst, ContractHLAst, FunctionCallGraph, ContractCallGraph, Context, FunctionCallAstNode } from "../../types"
import { isLocalCallGraphRelevantNode, isExternalDirectCall, getFullQualifiedFunctionCallIdent,
getFullQuallyfiedFuncDefinitionIdent, getContractName } from './staticAnalysisCommon'

@ -3,7 +3,7 @@ import { getDeclaredVariableName, getFullQuallyfiedFuncDefinitionIdent } from '.
import { default as algorithm } from './algorithmCategories'
import AbstractAst from './abstractAstView'
import { get } from 'fast-levenshtein'
import { util } from 'remix-lib'
import { util } from '@remix-project/remix-lib'
import { AnalyzerModule, ModuleAlgorithm, ModuleCategory, ReportObj, ContractHLAst, FunctionHLAst, VariableDeclarationAstNode, VisitFunction, ReportFunction, SupportedVersion} from './../../types'
interface SimilarRecord {

@ -447,7 +447,7 @@ function getUnAssignedTopLevelBinOps (subScope: BlockAstNode | IfStatementAstNod
if(subScope && subScope.nodeType === 'Block')
result = subScope.statements.filter(isBinaryOpInExpression)
// for 'without braces' loops
else if (subScope && subScope.nodeType && isSubScopeStatement(subScope)) {
else if (subScope && subScope.nodeType && subScope.nodeType !== 'Block' && isSubScopeStatement(subScope)) {
if (subScope.nodeType === 'IfStatement'){
if((subScope.trueBody && subScope.trueBody.nodeType === "ExpressionStatement" && isBinaryOpInExpression(subScope.trueBody)))
result.push(subScope.trueBody)

@ -1,8 +1,8 @@
import { default as test} from "tape"
import { helpers } from 'remix-lib'
import * as test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import { default as StatRunner } from '../../src/solidity-analyzer'
import * as modules from '../../src/solidity-analyzer/modules/'
import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types'
import { install, require as requireNPMmodule } from 'npm-install-version'

@ -1,8 +1,8 @@
import { default as test} from "tape"
import { helpers } from 'remix-lib'
import * as test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import { default as StatRunner } from '../../src/solidity-analyzer'
import * as modules from '../../src/solidity-analyzer/modules/'
import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types'
import { install, require as requireNPMmodule } from 'npm-install-version'
@ -301,7 +301,7 @@ test('Integration test similarVariableNames module', function (t: test.Test) {
test('Integration test blockTimestamp module', function (t: test.Test) {
t.plan(testFiles.length)
const module: any = require('../../dist/src/solidity-analyzer/modules/blockTimestamp').default
const module: any = modules.blockTimestamp
const lengthCheck: Record<string, number> = {
'KingOfTheEtherThrone.sol': 1,
'assembly.sol': 0,

@ -1,8 +1,8 @@
import { default as test} from "tape"
import { helpers } from 'remix-lib'
import * as test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import { default as StatRunner } from '../../src/solidity-analyzer'
import { CompilationResult, AnalysisReportObj, AnalysisReport, AnalyzerModule } from '../../src/types'
import { checksEffectsInteraction } from '../../src/solidity-analyzer/modules/'
import { install, require as requireNPMmodule } from 'npm-install-version'

@ -1,8 +1,8 @@
import { default as test} from "tape"
import { helpers } from 'remix-lib'
import * as test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import { default as StatRunner } from '../../src/solidity-analyzer'
import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types'
import { checksEffectsInteraction } from '../../src/solidity-analyzer/modules/'
import { install, require as requireNPMmodule } from 'npm-install-version'

@ -4,9 +4,12 @@
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"rootDir": "./",
"rootDir": "./src",
"types": ["node"]
},
"exclude": ["**/*.spec.ts"],
"exclude": [
"**/*.spec.ts",
"test/"
],
"include": ["**/*.ts"]
}

@ -4,10 +4,13 @@
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"rootDir": "./",
"rootDir": "./src",
"types": ["node"]
},
"exclude": ["**/*.spec.ts"],
"exclude": [
"**/*.spec.ts",
"tests/"
],
"include": ["**/*.ts"]
}

2982
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -135,7 +135,8 @@
"ethereumjs-block": "^2.2.2",
"ethereumjs-tx": "^2.1.2",
"ethereumjs-vm": "4.1.3",
"http-server": "^0.11.1"
"http-server": "^0.11.1",
"npm-install-version": "^6.0.2"
},
"devDependencies": {
"@babel/core": "^7.4.5",

@ -69,7 +69,7 @@
},
"remix-analyzer": {
"root": "libs/remix-analyzer",
"sourceRoot": "libs/remix-analyzer",
"sourceRoot": "libs/remix-analyzer/src",
"projectType": "library",
"schematics": {},
"architect": {
@ -104,7 +104,7 @@
"outputPath": "dist/libs/remix-analyzer",
"tsConfig": "libs/remix-analyzer/tsconfig.lib.json",
"packageJson": "libs/remix-analyzer/package.json",
"main": "libs/remix-analyzer/index.ts",
"main": "libs/remix-analyzer/src/index.ts",
"assets": ["libs/remix-analyzer/*.md"]
}
}

Loading…
Cancel
Save