trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

File decoders.ts has 1877 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import debugModule from "debug";
const debug = debugModule("decoder:decoders");

import * as Abi from "@truffle/abi-utils";
import * as Codec from "@truffle/codec";
Severity: Major
Found in packages/decoder/lib/decoders.ts - About 5 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      const spinners = Object.entries(statusByAddress).map(([address, status]) => {
        switch (status) {
          case "querying":
            return (
              <Box key={`address-${address}`}>
    Severity: Major
    Found in packages/db-kit/src/cli/decodeAddress/Splash.tsx and 1 other location - About 3 days to fix
    packages/db-kit/src/cli/decodeTransaction/Splash.tsx on lines 39..122

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 672.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      const spinners = Object.entries(statusByAddress).map(([address, status]) => {
        switch (status) {
          case "querying":
            return (
              <Box key={`address-${address}`}>
    Severity: Major
    Found in packages/db-kit/src/cli/decodeTransaction/Splash.tsx and 1 other location - About 3 days to fix
    packages/db-kit/src/cli/decodeAddress/Splash.tsx on lines 34..117

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 672.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File index.js has 1227 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import debugModule from "debug";
    const debug = debugModule("debugger:data:selectors");
    
    import { createSelectorTree, createLeaf } from "reselect-tree";
    import jsonpointer from "json-pointer";
    Severity: Major
    Found in packages/debugger/lib/data/selectors/index.js - About 3 days to fix

      Function interpreter has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring.
      Open

        async interpreter(cmd) {
          cmd = cmd.trim();
          let cmdArgs, splitArgs;
          debug("cmd %s", cmd);
      
      
      Severity: Minor
      Found in packages/core/lib/debug/interpreter.js - About 2 days 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

      File index.js has 1029 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import debugModule from "debug";
      const debug = debugModule("debugger:data:sagas");
      
      import { put, takeEvery, select } from "redux-saga/effects";
      
      
      Severity: Major
      Found in packages/debugger/lib/data/sagas/index.js - About 2 days to fix

        Function variablesAndMappingsSaga has 487 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function* variablesAndMappingsSaga() {
          // stack is only ready for interpretation after the last step of each
          // source range
          //
          // the data module always looks at the result of a particular opcode
        Severity: Major
        Found in packages/debugger/lib/data/sagas/index.js - About 2 days to fix

          Function interpreter has 399 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async interpreter(cmd) {
              cmd = cmd.trim();
              let cmdArgs, splitArgs;
              debug("cmd %s", cmd);
          
          
          Severity: Major
          Found in packages/core/lib/debug/interpreter.js - About 1 day to fix

            File encoders.ts has 813 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import debugModule from "debug";
            const debug = debugModule("encoder:encoders");
            
            import { FixedNumber as EthersFixedNumber } from "@ethersproject/bignumber";
            import { getAddress } from "@ethersproject/address";
            Severity: Major
            Found in packages/encoder/lib/encoders.ts - About 1 day to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              export const { TupleValue } = createCodecComponent(
                "TupleValue",
                ({ value }: Format.Values.TupleValue) => {
                  const { prefix, suffix } = useInjectedNode();
                  return (
              packages/codec-components/src/react/components/codec/format.values.array-value.tsx on lines 11..48

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 319.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              export const { ArrayValue } = createCodecComponent(
                "ArrayValue",
                ({ value }: Format.Values.ArrayValue) => {
                  const { prefix, suffix } = useInjectedNode();
                  return (
              packages/codec-components/src/react/components/codec/format.values.tuple-value.tsx on lines 11..48

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 319.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function normalize has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
              Open

                static normalize(compilations) {
                  let contexts = [];
                  let sources = {
                    user: {}, //by compilation
                    internal: {} //by context
              Severity: Minor
              Found in packages/debugger/lib/session/index.js - About 1 day 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

              File index.js has 738 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              const OS = require("os");
              const debug = require("debug")("debug-utils");
              const util = require("util");
              const Codec = require("@truffle/codec");
              const BN = require("bn.js");
              Severity: Major
              Found in packages/debug-utils/index.js - About 1 day to fix

                Function variablesAndMappingsSaga has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
                Open

                function* variablesAndMappingsSaga() {
                  // stack is only ready for interpretation after the last step of each
                  // source range
                  //
                  // the data module always looks at the result of a particular opcode
                Severity: Minor
                Found in packages/debugger/lib/data/sagas/index.js - About 1 day 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

                File printer.js has 726 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                const debugModule = require("debug");
                const debug = debugModule("lib:debug:printer");
                
                const path = require("path");
                const util = require("util");
                Severity: Major
                Found in packages/core/lib/debug/printer.js - About 1 day to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    public async update<M extends MutableCollectionName<C>>(
                      collectionName: M,
                      input: MutationInput<C, M>
                    ): Promise<MutationPayload<C, M>> {
                      const log = debug.extend(`${collectionName}:update`);
                  Severity: Major
                  Found in packages/db/src/meta/pouch/workspace.ts and 1 other location - About 1 day to fix
                  packages/db/src/meta/pouch/workspace.ts on lines 123..154

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 303.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    public async add<N extends CollectionName<C>>(
                      collectionName: N,
                      input: MutationInput<C, N>
                    ): Promise<MutationPayload<C, N>> {
                      const log = debug.extend(`${collectionName}:add`);
                  Severity: Major
                  Found in packages/db/src/meta/pouch/workspace.ts and 1 other location - About 1 day to fix
                  packages/db/src/meta/pouch/workspace.ts on lines 156..187

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 303.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Function transactionLog has 326 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function transactionLog(state = DEFAULT_TX_LOG, action) {
                    const { pointer, newPointer, step } = action;
                    const node = state.byPointer[pointer];
                    switch (action.type) {
                      case actions.RECORD_ORIGIN:
                  Severity: Major
                  Found in packages/debugger/lib/txlog/reducers.js - About 1 day to fix

                    File interpreter.js has 698 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    const debugModule = require("debug");
                    const debug = debugModule("lib:debug:interpreter");
                    
                    const path = require("path");
                    const util = require("util");
                    Severity: Major
                    Found in packages/core/lib/debug/interpreter.js - About 1 day to fix

                      Function transactionLog has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function transactionLog(state = DEFAULT_TX_LOG, action) {
                        const { pointer, newPointer, step } = action;
                        const node = state.byPointer[pointer];
                        switch (action.type) {
                          case actions.RECORD_ORIGIN:
                      Severity: Minor
                      Found in packages/debugger/lib/txlog/reducers.js - About 1 day 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

                      Severity
                      Category
                      Status
                      Source
                      Language