trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

Function stacktraceSaga has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function* stacktraceSaga() {
  const currentLocation = yield select(stacktrace.current.strippedLocation);
  const lastLocation = yield select(stacktrace.current.lastPosition);
  const returnCounter = yield select(stacktrace.current.returnCounter);
  let positionUpdated = false;
Severity: Minor
Found in packages/debugger/lib/stacktrace/sagas/index.js - About 1 hr to fix

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 mappedPaths has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function mappedPaths(state = DEFAULT_PATHS, action) {
  switch (action.type) {
    case actions.MAP_PATH_AND_ASSIGN:
      let { address, slot, typeIdentifier, parentType } = action;
      //how this case works: first, we find the spot in our table (based on
Severity: Minor
Found in packages/debugger/lib/data/reducers.js - About 1 hr to fix

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 _ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      _: createLeaf(["./raw", "./inlined/raw"], (scopes, inlined) =>
        scopes && inlined
          ? Object.assign(
              {},
              ...Object.entries(scopes).map(([id, scope]) => {
Severity: Minor
Found in packages/debugger/lib/data/selectors/index.js - About 1 hr to fix

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 aboutToModify has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      (node, invocation, index, next, nextInvocation, isContextChange) => {
        //ensure: current instruction is not a context change (because if it is
        //we cannot rely on the data.next selectors, but also if it is we know
        //we're not about to call a modifier or base constructor!)
        //we also want to return false if we can't find things for whatever
Severity: Minor
Found in packages/debugger/lib/data/selectors/index.js - About 1 hr to fix

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 formatBlockSpecifier has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const formatBlockSpecifier = (block: BlockSpecifier): string => {
  if (typeof block === "string" && stringWhitelist.includes(block)) {
    // block is one of 'latest', 'pending', 'earliest', or 'genesis'
    return block === "genesis"
      ? // convert old web3 input format which uses 'genesis'
Severity: Minor
Found in packages/encoder/lib/adapter.ts - About 1 hr to fix

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 startDebugger has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  async startDebugger(compilations) {
    const startMessage = DebugUtils.formatStartMessage(
      this.txHash !== undefined
    );
    const specifiedRegistry = this.config.noEns ? null : this.config.registry; //specified at the command line
Severity: Minor
Found in packages/core/lib/debug/cli.js - About 1 hr to fix

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 updatePrintouts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  updatePrintouts(userArgs, selections, printOuts) {
    let tempPrintouts = new Set();
    for (let argument of userArgs) {
      let fullSelection;
      if (argument[0] === "+" || argument[0] === "-") {
Severity: Minor
Found in packages/core/lib/debug/interpreter.js - About 1 hr to fix

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 configure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const configure = <C extends Config>(
  options: Options<C>
): (<I extends Base.Input<Batch<C>>, O extends Base.Output<Batch<C>>>(
  inputs: Base.Inputs<Batch<C>, I>
) => Process<Base.Outputs<Batch<C>, I & O>>) =>
Severity: Minor
Found in packages/db/src/project/loadMigrate/batch.ts - About 1 hr to fix

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 makeParseImports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function makeParseImports(parser: any) {
  const parseImports = (body: string) => {
    try {
      return Parser.parseImports(body, parser);
    } catch (err) {
Severity: Minor
Found in packages/compile-solidity/src/profiler/loadParser.ts - About 1 hr to fix

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 lastCompletedMigration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  lastCompletedMigration: async function (options: Config): Promise<number> {
    let Migrations: any; // I don't think we have a good type for this yet

    try {
      Migrations = options.resolver.require("Migrations");
Severity: Minor
Found in packages/migrate/src/index.ts - About 1 hr to fix

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 _withRetriesAsync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  private async _withRetriesAsync(f: Function) {
    const { maxRetries, retryDelayMsec } = this._options;

    for (let tryCount = 0; tryCount <= maxRetries; tryCount++) {
      try {
Severity: Minor
Found in packages/dashboard-message-bus-client/lib/client.ts - About 1 hr to fix

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 removeCompleteSpanPairs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function removeCompleteSpanPairs(spanTags: string[] | null) {
  if (spanTags === null) return [];
  let stillNeedsProcessing: boolean = true;
  while (stillNeedsProcessing) {
    let spanPairRemovedThisPass: boolean = false;

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 createSession has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function createSession({
  txHash,
  compilations,
  ganacheOptions,
  fetchingOptions,

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 constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(compilations, provider, moduleOptions, txHash) {
    /**
     * @private
     */
    const { store, sagaMiddleware } = configureStore(reducer, rootSaga, [
Severity: Minor
Found in packages/debugger/lib/session/index.js - About 1 hr to fix

    Function exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = async function (buildDir, options) {
      const Artifactor = require("@truffle/artifactor");
      const { Resolver } = require("@truffle/resolver");
      const Migrate = require("@truffle/migrate").default;
      const { Environment } = require("@truffle/environment");

      Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(options) {
          super();
          EventEmitter.call(this);
      
          expect.options(options, [
      Severity: Minor
      Found in packages/core/lib/console.js - About 1 hr to fix

        Function postDeploy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async postDeploy(data) {
            let message;
            if (data.deployed) {
              const txCostReport =
                await data.contract.interfaceAdapter.getTransactionCostReport(
        Severity: Minor
        Found in packages/events/defaultSubscribers/migrate/Reporter.js - About 1 hr to fix

          Function init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public async init(): Promise<void> {
              if (this.provider) {
                debug("provider given!");
                if (this.registryAddress !== undefined) {
                  debug("using custom registry address: %o", this.registryAddress);
          Severity: Minor
          Found in packages/encoder/lib/encoders.ts - About 1 hr to fix

            Function deriveChild has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function deriveChild(
              index: number,
              isHardened: boolean,
              privateKey: Buffer,
              publicKey: Uint8Array,
            Severity: Minor
            Found in packages/hdwallet/src/index.ts - About 1 hr to fix

              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(":"))) {
              Severity: Minor
              Found in packages/compile-solidity/src/run.ts - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language