trufflesuite/truffle

View on GitHub

Showing 685 of 1,401 total issues

Function resolvePossibleRelations has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function resolvePossibleRelations(
  relationship: "ancestor" | "descendant"
) {
  const { queryName, heightFilter, heightOrder } = relationshipProperties(
    relationship
Severity: Major
Found in packages/db/src/resources/networks/resolvePossibleRelations.ts - About 3 hrs to fix

    Function collectAllocationInfo has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function collectAllocationInfo(
      compilations: Compilations.Compilation[]
    ): ContextAndAllocationInfo {
      let contexts: Contexts.Contexts = {};
      let deployedContexts: Contexts.Contexts = {};
    Severity: Major
    Found in packages/codec/lib/abi-data/allocate/utils.ts - About 3 hrs to fix

      Function _deploy has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async _deploy(
          options: Config,
          context: MigrationContext,
          deployer: DeployerInterface,
          resolver: ResolverIntercept,
      Severity: Major
      Found in packages/migrate/src/Migration.ts - About 3 hrs to fix

        Function spinners has 82 lines of code (exceeds 25 allowed). 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 - About 3 hrs to fix

          Function spinners has 82 lines of code (exceeds 25 allowed). 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 - About 3 hrs to fix

            Function decodeMappingKeyCore has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            function* decodeMappingKeyCore(indexDefinition, keyDefinition) {
              const scopes = yield select(data.current.scopes.inlined);
              const compilationId = yield select(data.current.compilationId);
              const internalFor = yield select(data.current.internalSourceFor); //should be null, but...
              const currentAssignments = yield select(data.proc.assignments);
            Severity: Minor
            Found in packages/debugger/lib/data/sagas/index.js - About 3 hrs 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 processTarget has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            async function processTarget(target, cwd, logger) {
              const usesPath = target.path != undefined;
              const usesCommand = target.command != undefined;
              const usesStdin = target.stdin || target.stdin == undefined; // default true
              const usesProperties = target.properties || target.fileProperties;
            Severity: Minor
            Found in packages/external-compile/index.js - About 3 hrs 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 interpret has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              async interpret(input, context, filename, callback) {
                const processedInput = processInput(input);
                if (validTruffleConsoleCommands.includes(processedInput.split(/\s+/)[0])) {
                  try {
                    parseQuotesAndEscapes(processedInput); //we're just doing this to see
            Severity: Minor
            Found in packages/core/lib/console.js - About 3 hrs 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 resolveAllSources has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            export async function resolveAllSources({
              resolve,
              paths,
              shouldIncludePath,
              parseImports
            Severity: Minor
            Found in packages/profiler/src/resolveAllSources.ts - About 3 hrs 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 decodeMappingKeyCore has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function* decodeMappingKeyCore(indexDefinition, keyDefinition) {
              const scopes = yield select(data.current.scopes.inlined);
              const compilationId = yield select(data.current.compilationId);
              const internalFor = yield select(data.current.internalSourceFor); //should be null, but...
              const currentAssignments = yield select(data.proc.assignments);
            Severity: Major
            Found in packages/debugger/lib/data/sagas/index.js - About 3 hrs to fix

              Function getFunctionsByProgramCounter has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getFunctionsByProgramCounter: function (
                  instructions,
                  asts,
                  overlapFunctions,
                  compilationId
              Severity: Major
              Found in packages/source-map-utils/index.js - About 3 hrs to fix

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

                import debugModule from "debug";
                const debug = debugModule("debugger:txlog:sagas");
                
                import { put, takeEvery, select } from "redux-saga/effects";
                import { prefixName } from "lib/helpers";
                Severity: Minor
                Found in packages/debugger/lib/txlog/sagas/index.js - About 3 hrs to fix

                  Function formatStacktrace has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    formatStacktrace: function (stacktrace, indent = 2) {
                      //get message or panic code from stacktrace
                      const { message, panic, custom } = stacktrace[0];
                      //we want to print inner to outer, so first, let's
                      //reverse
                  Severity: Major
                  Found in packages/debug-utils/index.js - About 3 hrs to fix

                    Function printRevertMessage has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async printRevertMessage() {
                        this.config.logger.log(
                          DebugUtils.truffleColors.red("Transaction halted with a RUNTIME ERROR.")
                        );
                        this.config.logger.log("");
                    Severity: Major
                    Found in packages/core/lib/debug/printer.js - About 3 hrs to fix

                      Function decodeLiteral has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function* decodeLiteral(
                        dataType: Format.Types.Type,
                        pointer: Pointer.StackLiteralPointer,
                        info: Evm.EvmInfo
                      ): Generator<DecoderRequest, Format.Values.Result, Uint8Array | null> {
                      Severity: Major
                      Found in packages/codec/lib/stack/decode/index.ts - About 3 hrs to fix

                        File command-utils.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        const { bundled, core } = require("../lib/version").info();
                        const OS = require("os");
                        const analytics = require("../lib/services/analytics");
                        const { extractFlags } = require("./utils/utils"); // contains utility methods
                        const globalCommandOptions = require("./global-command-options");
                        Severity: Minor
                        Found in packages/core/lib/command-utils.js - About 3 hrs to fix

                          Function parse has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const parse = function (args) {
                            if (args.length === 0) {
                              return null;
                            }
                          
                          
                          Severity: Major
                          Found in packages/core/lib/commands/config/run.js - About 3 hrs to fix

                            Function isUsableCompilation has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                              isUsableCompilation: function (compilation) {
                                //check #1: is the source order reliable?
                                if (compilation.unreliableSourceOrder) {
                                  debug("unreliable source order");
                                  return false;
                            Severity: Minor
                            Found in packages/debug-utils/index.js - About 3 hrs 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 Debugger has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function Debugger(): JSX.Element {
                              const { classes } = useStyles();
                              const [inputValue, setInputValue] = useInputState("");
                              const [sessionUpdated, { increment: sessionTick }] = useCounter();
                              const {
                            Severity: Minor
                            Found in packages/dashboard/src/components/composed/Debugger/index.tsx - About 3 hrs 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 markTextHighlighted has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function markTextHighlighted(source: Source, sourceRange: SourceRange) {
                              const fullyHighlightedLines = new Set<number>();
                              const editedLines = source.contents.split("\n").map((line, index) => {
                                if (line.length === 0) {
                                  return line;

                            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