diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-17 18:59:02 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-07-17 18:59:02 +0800 |
commit | bf8ac3b9e6ee59f267f7850418febfe84dedceb8 (patch) | |
tree | 0617e583892f9a8fe96a55dcac3a7f9af1ddae10 /packages/sol-cov/src | |
parent | edcdc9b1b903158cc61529853d7e9028ecbc266a (diff) | |
download | dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.gz dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.tar.zst dexon-0x-contracts-bf8ac3b9e6ee59f267f7850418febfe84dedceb8.zip |
Fix tslint issues
Diffstat (limited to 'packages/sol-cov/src')
9 files changed, 23 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 220a9f98c..8e03bf7fd 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 @@ -12,8 +12,8 @@ import { AbstractArtifactAdapter } from './abstract_artifact_adapter'; const CONFIG_FILE = 'compiler.json'; export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { - private _artifactsPath: string; - private _sourcesPath: string; + private readonly _artifactsPath: string; + private readonly _sourcesPath: string; constructor(artifactsPath?: string, sourcesPath?: string) { super(); const config: CompilerOptions = fs.existsSync(CONFIG_FILE) 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 53449e5e1..53b77aed5 100644 --- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts @@ -7,8 +7,8 @@ import { AbstractArtifactAdapter } from './abstract_artifact_adapter'; import { SolCompilerArtifactAdapter } from './sol_compiler_artifact_adapter'; export class TruffleArtifactAdapter extends AbstractArtifactAdapter { - private _solcVersion: string; - private _sourcesPath: string; + private readonly _solcVersion: string; + private readonly _sourcesPath: string; constructor(sourcesPath: string, solcVersion: string) { super(); this._solcVersion = solcVersion; diff --git a/packages/sol-cov/src/ast_visitor.ts b/packages/sol-cov/src/ast_visitor.ts index a6bca4704..e55cdf6ec 100644 --- a/packages/sol-cov/src/ast_visitor.ts +++ b/packages/sol-cov/src/ast_visitor.ts @@ -18,15 +18,15 @@ enum BranchType { export class ASTVisitor { private _entryId = 0; - private _fnMap: FnMap = {}; - private _branchMap: BranchMap = {}; - private _modifiersStatementIds: number[] = []; - private _statementMap: StatementMap = {}; - private _locationByOffset: LocationByOffset; - private _ignoreRangesBeginningAt: number[]; + private readonly _fnMap: FnMap = {}; + private readonly _branchMap: BranchMap = {}; + private readonly _modifiersStatementIds: number[] = []; + private readonly _statementMap: StatementMap = {}; + private readonly _locationByOffset: LocationByOffset; + private readonly _ignoreRangesBeginningAt: number[]; // keep track of contract/function ranges that are to be ignored // so we can also ignore any children nodes within the contract/function - private _ignoreRangesWithin: Array<[number, number]> = []; + private readonly _ignoreRangesWithin: Array<[number, number]> = []; constructor(locationByOffset: LocationByOffset, ignoreRangesBeginningAt: number[] = []) { this._locationByOffset = locationByOffset; this._ignoreRangesBeginningAt = ignoreRangesBeginningAt; diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 45843bc96..9667e891c 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -23,7 +23,7 @@ import { utils } from './utils'; * It's used to compute your code coverage while running solidity tests. */ export class CoverageSubprovider extends TraceInfoSubprovider { - private _coverageCollector: TraceCollector; + private readonly _coverageCollector: TraceCollector; /** * Instantiates a CoverageSubprovider instance * @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.) diff --git a/packages/sol-cov/src/get_source_range_snippet.ts b/packages/sol-cov/src/get_source_range_snippet.ts index 30d6ec802..bea17beae 100644 --- a/packages/sol-cov/src/get_source_range_snippet.ts +++ b/packages/sol-cov/src/get_source_range_snippet.ts @@ -38,7 +38,7 @@ export function getSourceRangeSnippet(sourceRange: SourceRange, sourceCode: stri // A visitor which collects ASTInfo for most nodes in the AST. class ASTInfoVisitor { - private _astInfos: ASTInfo[] = []; + private readonly _astInfos: ASTInfo[] = []; public getASTInfoForRange(sourceRange: SourceRange): ASTInfo | null { // HACK(albrow): Sometimes the source range doesn't exactly match that // of astInfo. To work around that we try with a +/-1 offset on diff --git a/packages/sol-cov/src/profiler_subprovider.ts b/packages/sol-cov/src/profiler_subprovider.ts index 9f98da524..ae9351f17 100644 --- a/packages/sol-cov/src/profiler_subprovider.ts +++ b/packages/sol-cov/src/profiler_subprovider.ts @@ -12,7 +12,7 @@ import { utils } from './utils'; * ProfilerSubprovider is used to profile Solidity code while running tests. */ export class ProfilerSubprovider extends TraceInfoSubprovider { - private _profilerCollector: TraceCollector; + private readonly _profilerCollector: TraceCollector; /** * Instantiates a ProfilerSubprovider instance * @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.) diff --git a/packages/sol-cov/src/revert_trace_subprovider.ts b/packages/sol-cov/src/revert_trace_subprovider.ts index fed305bd3..6ccf59653 100644 --- a/packages/sol-cov/src/revert_trace_subprovider.ts +++ b/packages/sol-cov/src/revert_trace_subprovider.ts @@ -18,8 +18,8 @@ import { utils } from './utils'; export class RevertTraceSubprovider extends TraceCollectionSubprovider { // Lock is used to not accept normal transactions while doing call/snapshot magic because they'll be reverted later otherwise private _contractsData!: ContractData[]; - private _artifactAdapter: AbstractArtifactAdapter; - private _logger: Logger; + private readonly _artifactAdapter: AbstractArtifactAdapter; + private readonly _logger: Logger; /** * Instantiates a RevertTraceSubprovider instance diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index 9866472b9..b530b59db 100644 --- a/packages/sol-cov/src/trace_collection_subprovider.ts +++ b/packages/sol-cov/src/trace_collection_subprovider.ts @@ -32,10 +32,10 @@ export interface TraceCollectionSubproviderConfig { export abstract class TraceCollectionSubprovider extends Subprovider { protected _web3Wrapper!: Web3Wrapper; // Lock is used to not accept normal transactions while doing call/snapshot magic because they'll be reverted later otherwise - private _lock = new Lock(); - private _defaultFromAddress: string; + private readonly _lock = new Lock(); + private readonly _defaultFromAddress: string; private _isEnabled = true; - private _config: TraceCollectionSubproviderConfig; + private readonly _config: TraceCollectionSubproviderConfig; /** * Instantiates a TraceCollectionSubprovider instance * @param defaultFromAddress default from address to use when sending transactions diff --git a/packages/sol-cov/src/trace_collector.ts b/packages/sol-cov/src/trace_collector.ts index 1b458edec..3e2ae3516 100644 --- a/packages/sol-cov/src/trace_collector.ts +++ b/packages/sol-cov/src/trace_collector.ts @@ -33,11 +33,11 @@ export type SingleFileSubtraceHandler = ( * TraceCollector is used by CoverageSubprovider to compute code coverage based on collected trace data. */ export class TraceCollector { - private _artifactAdapter: AbstractArtifactAdapter; - private _logger: Logger; + private readonly _artifactAdapter: AbstractArtifactAdapter; + private readonly _logger: Logger; private _contractsData!: ContractData[]; - private _collector = new Collector(); - private _singleFileSubtraceHandler: SingleFileSubtraceHandler; + private readonly _collector = new Collector(); + private readonly _singleFileSubtraceHandler: SingleFileSubtraceHandler; /** * Instantiates a TraceCollector instance |