trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

Function formatLinePointer has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    line,
    startCol,
    endCol,
    padding,
    tabLength = DEFAULT_TAB_WIDTH
Severity: Minor
Found in packages/debug-utils/index.js - About 35 mins to fix

    Function formatRangeLines has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        source,
        range,
        uncolorizedSource,
        contextBefore = 2,
        contextAfter = 0
    Severity: Minor
    Found in packages/debug-utils/index.js - About 35 mins to fix

      Function deriveChild has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        index: number,
        isHardened: boolean,
        privateKey: Buffer,
        publicKey: Uint8Array,
        chainCode: Uint8Array
      Severity: Minor
      Found in packages/hdwallet/src/index.ts - About 35 mins to fix

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

              case "INT":
                return data.gas
                  ? this.messages.errors("intWithGas", data)
                  : this.messages.errors("intNoGas", data);
        Severity: Major
        Found in packages/events/defaultSubscribers/migrate/Reporter.js and 3 other locations - About 35 mins to fix
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 94..97
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 100..103
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 106..109

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

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

          stack: {
            overflow: "scroll",
            height: "100%",
            backgroundColor:
              theme.colorScheme === "dark" ? theme.colors["truffle-brown"][8] : "white"
        Severity: Major
        Found in packages/dashboard/src/components/composed/Debugger/Stack.tsx and 3 other locations - About 35 mins to fix
        packages/dashboard/src/components/composed/Debugger/Breakpoints/index.tsx on lines 36..41
        packages/dashboard/src/components/composed/Debugger/Sources/Source/index.tsx on lines 11..16
        packages/dashboard/src/components/composed/Debugger/Variables.tsx on lines 35..40

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

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

          sourceContainer: {
            overflow: "scroll",
            height: "100%",
            backgroundColor:
              theme.colorScheme === "dark" ? theme.colors["truffle-brown"][8] : "white"
        packages/dashboard/src/components/composed/Debugger/Breakpoints/index.tsx on lines 36..41
        packages/dashboard/src/components/composed/Debugger/Stack.tsx on lines 32..37
        packages/dashboard/src/components/composed/Debugger/Variables.tsx on lines 35..40

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

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

          variables: {
            overflow: "scroll",
            height: "100%",
            backgroundColor:
              theme.colorScheme === "dark" ? theme.colors["truffle-brown"][8] : "white"
        packages/dashboard/src/components/composed/Debugger/Breakpoints/index.tsx on lines 36..41
        packages/dashboard/src/components/composed/Debugger/Sources/Source/index.tsx on lines 11..16
        packages/dashboard/src/components/composed/Debugger/Stack.tsx on lines 32..37

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

        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

          let { binary } = yield take(
            action => action.type == actions.RECEIVE_BINARY && action.address == address
          );
        Severity: Minor
        Found in packages/debugger/lib/web3/sagas/index.js and 2 other locations - About 35 mins to fix
        packages/debugger/lib/web3/sagas/index.js on lines 232..235
        packages/debugger/lib/web3/sagas/index.js on lines 252..254

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

        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

          const { address } = yield take(
            action => action.type == actions.RECEIVE_ENS_ADDRESS && action.name == name
          );
        Severity: Minor
        Found in packages/debugger/lib/web3/sagas/index.js and 2 other locations - About 35 mins to fix
        packages/debugger/lib/web3/sagas/index.js on lines 206..208
        packages/debugger/lib/web3/sagas/index.js on lines 232..235

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

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

          breakpoints: {
            overflow: "scroll",
            height: "100%",
            backgroundColor:
              theme.colorScheme === "dark" ? theme.colors["truffle-brown"][8] : "white"
        packages/dashboard/src/components/composed/Debugger/Sources/Source/index.tsx on lines 11..16
        packages/dashboard/src/components/composed/Debugger/Stack.tsx on lines 32..37
        packages/dashboard/src/components/composed/Debugger/Variables.tsx on lines 35..40

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

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

              case "INV":
                return data.reason
                  ? this.messages.errors("asrtReason", data)
                  : this.messages.errors("asrtNoReason", data);
        Severity: Major
        Found in packages/events/defaultSubscribers/migrate/Reporter.js and 3 other locations - About 35 mins to fix
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 82..85
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 94..97
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 106..109

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

        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

        export function messageIsDecodable(message: DashboardProviderMessage) {
          return (decodableRpcMethods as Set<string>).has(message.payload.method);
        }
        Severity: Minor
        Found in packages/dashboard/src/utils/dash.ts and 2 other locations - About 35 mins to fix
        packages/dashboard/src/utils/dash.ts on lines 26..28
        packages/dashboard/src/utils/dash.ts on lines 30..32

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

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

              case "BLK":
                return data.gas
                  ? this.messages.errors("blockWithGas", data)
                  : this.messages.errors("blockNoGas", data);
        Severity: Major
        Found in packages/events/defaultSubscribers/migrate/Reporter.js and 3 other locations - About 35 mins to fix
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 82..85
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 94..97
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 100..103

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

        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

        export function messageNeedsInteraction(message: DashboardProviderMessage) {
          return (interactiveRpcMethods as Set<string>).has(message.payload.method);
        }
        Severity: Minor
        Found in packages/dashboard/src/utils/dash.ts and 2 other locations - About 35 mins to fix
        packages/dashboard/src/utils/dash.ts on lines 22..24
        packages/dashboard/src/utils/dash.ts on lines 30..32

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

        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

          const { name } = yield take(
            action =>
              action.type == actions.RECEIVE_ENS_NAME && action.address == address
          );
        Severity: Minor
        Found in packages/debugger/lib/web3/sagas/index.js and 2 other locations - About 35 mins to fix
        packages/debugger/lib/web3/sagas/index.js on lines 206..208
        packages/debugger/lib/web3/sagas/index.js on lines 252..254

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

        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

        export function messageIsUnsupported(message: DashboardProviderMessage) {
          return (unsupportedRpcMethods as Set<string>).has(message.payload.method);
        }
        Severity: Minor
        Found in packages/dashboard/src/utils/dash.ts and 2 other locations - About 35 mins to fix
        packages/dashboard/src/utils/dash.ts on lines 22..24
        packages/dashboard/src/utils/dash.ts on lines 26..28

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

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

              case "RVT":
                return data.reason
                  ? this.messages.errors("rvtReason", data)
                  : this.messages.errors("rvtNoReason", data);
        Severity: Major
        Found in packages/events/defaultSubscribers/migrate/Reporter.js and 3 other locations - About 35 mins to fix
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 82..85
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 100..103
        packages/events/defaultSubscribers/migrate/Reporter.js on lines 106..109

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

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

        export function* reverseResolve(address) {
          debug("reverse resolving %s", address);
          const cache = yield select(ens.current.cache);
          if (address in cache) {
            debug("got cached %o", cache[address]);
        Severity: Minor
        Found in packages/debugger/lib/ens/sagas/index.js - About 35 mins 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 functionDepthSaga has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function* functionDepthSaga() {
          if (yield select(sourcemapping.current.willReturn)) {
            //we do this case first so we can be sure we're not failing in any of the
            //other cases below!
            yield put(actions.externalReturn());
        Severity: Minor
        Found in packages/debugger/lib/sourcemapping/sagas/index.js - About 35 mins 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 functionDepthStack has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function functionDepthStack(state = [], action) {
          switch (action.type) {
            case actions.JUMP:
              let newState = state.slice(); //clone the state
              const delta = spelunk(action.jumpDirection);
        Severity: Minor
        Found in packages/debugger/lib/sourcemapping/reducers.js - About 35 mins 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