trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

Function decodeTransactionWithAdditionalContexts has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public async decodeTransactionWithAdditionalContexts(
    transaction: DecoderTypes.Transaction,
    additionalContexts: Contexts.Contexts = {},
    additionalAllocations?: {
      [
Severity: Major
Found in packages/decoder/lib/decoders.ts - About 3 hrs to fix

    Function abiParameterToType has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function abiParameterToType(abi: Parameter): Format.Types.Type {
      let typeName = abi.type;
      let typeHint = abi.internalType;
      //first: is it an array?
      let arrayMatch = typeName.match(/(.*)\[(\d*)\]$/);
    Severity: Major
    Found in packages/codec/lib/abi-data/import/index.ts - About 3 hrs to fix

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

          } else if (
            decoding.kind === "function" &&
            decoding.abi.name === "aggregate3" &&
            decoding.abi.inputs.length === 1 &&
            decoding.abi.inputs[0].type === "tuple[]" &&
      Severity: Major
      Found in packages/decoder/lib/decoders.ts and 2 other locations - About 3 hrs to fix
      packages/decoder/lib/decoders.ts on lines 1071..1158
      packages/decoder/lib/decoders.ts on lines 1127..1158

      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 109.

      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 3 locations. Consider refactoring.
      Open

          } else if (
            decoding.kind === "function" &&
            decoding.abi.name === "aggregate3Value" &&
            decoding.abi.inputs.length === 1 &&
            decoding.abi.inputs[0].type === "tuple[]" &&
      Severity: Major
      Found in packages/decoder/lib/decoders.ts and 2 other locations - About 3 hrs to fix
      packages/decoder/lib/decoders.ts on lines 1071..1158
      packages/decoder/lib/decoders.ts on lines 1099..1158

      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 109.

      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 3 locations. Consider refactoring.
      Open

          if (
            decoding.kind === "function" &&
            (decoding.abi.name === "aggregate" ||
              decoding.abi.name === "blockAndAggregate") &&
            decoding.abi.inputs.length === 1 &&
      Severity: Major
      Found in packages/decoder/lib/decoders.ts and 2 other locations - About 3 hrs to fix
      packages/decoder/lib/decoders.ts on lines 1099..1158
      packages/decoder/lib/decoders.ts on lines 1127..1158

      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 109.

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

      export function resolveRelations(relationship: "ancestor" | "descendant") {
        const {
          reverseRelationship,
          superlativeOption,
          heightBoundOption,
      Severity: Major
      Found in packages/db/src/resources/networks/resolveRelations.ts - About 3 hrs to fix

        Spinner has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class Spinner {
          name: string;
        
          constructor(name: string, options: Partial<SpinnerOptions>);
          constructor(name: string, text: string);
        Severity: Minor
        Found in packages/spinners/lib/spinner.ts - About 3 hrs to fix

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

          export type Batch<C extends Config> = {
            structure: Structure<C>;
            breadcrumb: Breadcrumb<C>;
            input: Input<C>;
            output: Output<C>;
          Severity: Major
          Found in packages/db/src/project/assignNames/batch.ts and 1 other location - About 3 hrs to fix
          packages/db/src/project/loadMigrate/batch.ts on lines 75..82

          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 107.

          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

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

          export type Batch<C extends Config> = {
            structure: Structure<C>;
            breadcrumb: Breadcrumb<C>;
            input: Input<C>;
            output: Output<C>;
          Severity: Major
          Found in packages/db/src/project/loadMigrate/batch.ts and 1 other location - About 3 hrs to fix
          packages/db/src/project/assignNames/batch.ts on lines 42..49

          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 107.

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

                  (
                    assignments,
                    identifiers,
                    definitions,
                    scopes,
          Severity: Minor
          Found in packages/debugger/lib/data/selectors/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 useStyles has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const useStyles = createStyles((theme, _params, getRef) => {
            const {
              colors,
              colorScheme,
              white,
          Severity: Major
          Found in packages/dashboard/src/components/composed/RPCs/RPC/Overview.tsx - About 3 hrs to fix

            Function start has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async start() {
                if (this.httpServer?.listening) {
                  return;
                }
            
            
            Severity: Major
            Found in packages/dashboard/lib/DashboardServer.ts - About 3 hrs to fix

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

                return (
                  <Flex direction="column" className={classes.variablesContainer}>
                    <div className={classes.sectionHeader}>Variables</div>
                    <div className={classes.variables}>
                      <pre className={classes.variablesContent}>{output}</pre>
              packages/dashboard/src/components/composed/Debugger/Breakpoints/index.tsx on lines 90..97
              packages/dashboard/src/components/composed/Debugger/Stack.tsx on lines 91..98

              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 104.

              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 recordsById: {
                    [id: string]: Record<T>;
                  } = records
                    .filter((record): record is Record<T> => !!record)
                    .map(record => ({
              Severity: Major
              Found in packages/db/src/meta/pouch/adapters/base.ts and 1 other location - About 3 hrs to fix
              packages/db/src/meta/pouch/adapters/base.ts on lines 225..233

              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 104.

              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 3 locations. Consider refactoring.
              Open

                return (
                  <Flex direction="column" className={classes.stackContainer}>
                    <div className={classes.sectionHeader}>Stack</div>
                    <div className={classes.stack}>
                      <pre className={classes.stackContent}>{output}</pre>
              packages/dashboard/src/components/composed/Debugger/Breakpoints/index.tsx on lines 90..97
              packages/dashboard/src/components/composed/Debugger/Variables.tsx on lines 139..146

              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 104.

              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 savedRecordById = savedRecords
                    .filter((savedRecord): savedRecord is SavedRecord<T> => !!savedRecord)
                    .map(savedRecord => ({
                      [savedRecord._id]: savedRecord
                    }))
              Severity: Major
              Found in packages/db/src/meta/pouch/adapters/base.ts and 1 other location - About 3 hrs to fix
              packages/db/src/meta/pouch/adapters/base.ts on lines 154..161

              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 104.

              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 3 locations. Consider refactoring.
              Open

                return (
                  <Flex direction="column" className={classes.breakpointsContainer}>
                    <div className={classes.sectionHeader}>Breakpoints</div>
                    <div className={classes.breakpoints}>
                      <pre className={classes.breakpointsContent}>{breakpointsList}</pre>
              packages/dashboard/src/components/composed/Debugger/Stack.tsx on lines 91..98
              packages/dashboard/src/components/composed/Debugger/Variables.tsx on lines 139..146

              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 104.

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

                getFunctionsByProgramCounter: function (
                  instructions,
                  asts,
                  overlapFunctions,
                  compilationId
              Severity: Minor
              Found in packages/source-map-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 parseCode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function parseCode(
                hexString: string,
                { maxInstructionCount, attemptStripMetadata }: DisassemblyOptions = {}
              ): Instruction[] {
                // Convert to an array of bytes
              Severity: Minor
              Found in packages/code-utils/src/index.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 interpretAggregate has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async interpretAggregate(
                  decoding: Codec.CalldataDecoding,
                  transaction: DecoderTypes.Transaction,
                  additionalContexts: Contexts.Contexts = {},
                  additionalAllocations?: {
              Severity: Major
              Found in packages/decoder/lib/decoders.ts - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language