File run.ts
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { zeroLinkReferences, formatLinkReferences } from "./shims";
import debugModule from "debug";
const debug = debugModule("compile:run");
import OS = require("os");
import semver from "semver";
Function run
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function run(
rawSources: { [name: string]: string },
options: Config,
internalOptions: InternalOptions = {}
): Promise<Compilation | null> {
Function repairOldContracts
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function repairOldContracts(contracts: Contracts): Contracts {
const contractNames = Object.values(contracts)
.map(source => Object.keys(source))
.flat();
if (contractNames.some(name => name.includes(":"))) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function repairOldContracts
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function repairOldContracts(contracts: Contracts): Contracts {
const contractNames = Object.values(contracts)
.map(source => Object.keys(source))
.flat();
if (contractNames.some(name => name.includes(":"))) {
Function run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export async function run(
rawSources: { [name: string]: string },
options: Config,
internalOptions: InternalOptions = {}
): Promise<Compilation | null> {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function processAllSources
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function processAllSources({
sources,
compilerOutput,
originalSourcePaths,
language
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function detectErrors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function detectErrors({
compilerOutput,
options,
solcVersion
}: {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function orderABI
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function orderABI({ abi, contractName, ast }) {
if (!abi) {
return []; //Yul doesn't return ABIs, but we require something
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"