aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov
diff options
context:
space:
mode:
authorFrancesco Agosti <francesco.agosti93@gmail.com>2018-06-07 08:21:09 +0800
committerGitHub <noreply@github.com>2018-06-07 08:21:09 +0800
commit67c4ad128c405692e471274148c9a2ef7cd8b6ca (patch)
treeb410c792b110bbae4d1814aab8115b2b3120f65d /packages/sol-cov
parent5989844f1c3d00f57f1ab86a00aa97e17751c576 (diff)
parent870eca0d9f875f784c1847993246db3097f68405 (diff)
downloaddexon-0x-contracts-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar.gz
dexon-0x-contracts-67c4ad128c405692e471274148c9a2ef7cd8b6ca.tar.zst
dexon-0x-contracts-67c4ad128c405692e471274148c9a2ef7cd8b6ca.zip
Merge pull request #662 from 0xProject/feature/improve-linting
Tried enabling no-unused-variable...
Diffstat (limited to 'packages/sol-cov')
-rw-r--r--packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts1
-rw-r--r--packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts4
-rw-r--r--packages/sol-cov/src/collect_coverage_entries.ts2
-rw-r--r--packages/sol-cov/src/coverage_manager.ts10
-rw-r--r--packages/sol-cov/src/coverage_subprovider.ts1
-rw-r--r--packages/sol-cov/src/source_maps.ts2
-rw-r--r--packages/sol-cov/src/trace.ts5
-rw-r--r--packages/sol-cov/test/instructions_test.ts2
-rw-r--r--packages/sol-cov/test/trace_test.ts2
9 files changed, 6 insertions, 23 deletions
diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
index d08828bf6..6e385203b 100644
--- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
@@ -32,7 +32,6 @@ export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter {
const artifact = JSON.parse(fs.readFileSync(artifactFileName).toString());
let sources = _.keys(artifact.sources);
sources = _.map(sources, relativeFilePath => path.resolve(this._sourcesPath, relativeFilePath));
- const contractName = artifact.contractName;
const sourceCodes = _.map(sources, (source: string) => fs.readFileSync(source).toString());
const contractData = {
sourceCodes,
diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
index c7f21b6eb..53449e5e1 100644
--- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
@@ -1,8 +1,4 @@
import { Compiler, CompilerOptions } from '@0xproject/sol-compiler';
-import * as fs from 'fs';
-import * as glob from 'glob';
-import * as _ from 'lodash';
-import * as path from 'path';
import * as rimraf from 'rimraf';
import { ContractData } from '../types';
diff --git a/packages/sol-cov/src/collect_coverage_entries.ts b/packages/sol-cov/src/collect_coverage_entries.ts
index 97218616c..b145f044e 100644
--- a/packages/sol-cov/src/collect_coverage_entries.ts
+++ b/packages/sol-cov/src/collect_coverage_entries.ts
@@ -1,7 +1,5 @@
import * as ethUtil from 'ethereumjs-util';
-import * as fs from 'fs';
import * as _ from 'lodash';
-import * as path from 'path';
import * as parser from 'solidity-parser-antlr';
import { ASTVisitor, CoverageEntriesDescription } from './ast_visitor';
diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts
index 31b0e6fbc..064338a32 100644
--- a/packages/sol-cov/src/coverage_manager.ts
+++ b/packages/sol-cov/src/coverage_manager.ts
@@ -1,11 +1,10 @@
import { promisify } from '@0xproject/utils';
-import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util';
+import { stripHexPrefix } from 'ethereumjs-util';
import * as fs from 'fs';
import { Collector } from 'istanbul';
import * as _ from 'lodash';
-import { getLogger, levels, Logger, LogLevel } from 'loglevel';
+import { getLogger, levels, Logger } from 'loglevel';
import * as mkdirp from 'mkdirp';
-import * as path from 'path';
import { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter';
import { collectCoverageEntries } from './collect_coverage_entries';
@@ -14,18 +13,14 @@ import { parseSourceMap } from './source_maps';
import {
BranchCoverage,
BranchDescription,
- BranchMap,
ContractData,
Coverage,
- FnMap,
FunctionCoverage,
FunctionDescription,
- LineColumn,
SingleFileSourceRange,
SourceRange,
StatementCoverage,
StatementDescription,
- StatementMap,
TraceInfo,
TraceInfoExistingContract,
TraceInfoNewContract,
@@ -38,6 +33,7 @@ export class CoverageManager {
private _artifactAdapter: AbstractArtifactAdapter;
private _logger: Logger;
private _traceInfos: TraceInfo[] = [];
+ // tslint:disable-next-line:no-unused-variable
private _getContractCodeAsync: (address: string) => Promise<string>;
private static _getSingleFileCoverageForTrace(
contractData: ContractData,
diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts
index ca7f4aed2..13b76f537 100644
--- a/packages/sol-cov/src/coverage_subprovider.ts
+++ b/packages/sol-cov/src/coverage_subprovider.ts
@@ -1,6 +1,5 @@
import { Callback, ErrorCallback, NextCallback, Subprovider } from '@0xproject/subproviders';
import { BlockParam, CallData, JSONRPCRequestPayload, TransactionTrace, TxData } from 'ethereum-types';
-import * as fs from 'fs';
import * as _ from 'lodash';
import { Lock } from 'semaphore-async-await';
diff --git a/packages/sol-cov/src/source_maps.ts b/packages/sol-cov/src/source_maps.ts
index 694171442..f9503e16c 100644
--- a/packages/sol-cov/src/source_maps.ts
+++ b/packages/sol-cov/src/source_maps.ts
@@ -38,10 +38,10 @@ export function parseSourceMap(
const pcToInstructionIndex: { [programCounter: number]: number } = getPcToInstructionIndexMapping(bytecode);
const locationByOffsetByFileIndex = _.map(sourceCodes, getLocationByOffset);
const entries = srcMap.split(';');
- const parsedEntries: SourceLocation[] = [];
let lastParsedEntry: SourceLocation = {} as any;
const instructionIndexToSourceRange: { [instructionIndex: number]: SourceRange } = {};
_.each(entries, (entry: string, i: number) => {
+ // tslint:disable-next-line:no-unused-variable
const [instructionIndexStrIfExists, lengthStrIfExists, fileIndexStrIfExists, jumpTypeStrIfExists] = entry.split(
':',
);
diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts
index 1c21c8e5c..c725de3d0 100644
--- a/packages/sol-cov/src/trace.ts
+++ b/packages/sol-cov/src/trace.ts
@@ -1,7 +1,6 @@
import { addressUtils, BigNumber, logUtils } from '@0xproject/utils';
-import { OpCode, StructLog, TransactionTrace } from 'ethereum-types';
-import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util';
-import * as fs from 'fs';
+import { OpCode, StructLog } from 'ethereum-types';
+import { addHexPrefix } from 'ethereumjs-util';
import * as _ from 'lodash';
export interface TraceByContractAddress {
diff --git a/packages/sol-cov/test/instructions_test.ts b/packages/sol-cov/test/instructions_test.ts
index 8012674f5..02f30a5ca 100644
--- a/packages/sol-cov/test/instructions_test.ts
+++ b/packages/sol-cov/test/instructions_test.ts
@@ -1,8 +1,6 @@
import * as chai from 'chai';
-import * as fs from 'fs';
import 'make-promises-safe';
import 'mocha';
-import * as path from 'path';
import { constants } from '../src/constants';
import { getPcToInstructionIndexMapping } from '../src/instructions';
diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts
index 07e270b71..7a034362c 100644
--- a/packages/sol-cov/test/trace_test.ts
+++ b/packages/sol-cov/test/trace_test.ts
@@ -1,9 +1,7 @@
import * as chai from 'chai';
import { OpCode, StructLog } from 'ethereum-types';
-import * as fs from 'fs';
import * as _ from 'lodash';
import 'mocha';
-import * as path from 'path';
import { getTracesByContractAddress } from '../src/trace';