trufflesuite/truffle

View on GitHub

Showing 1,401 of 1,401 total issues

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

  let summaryElement = (
    <Box>
      <Box paddingLeft={1} paddingRight={1}>
        <Text color="green">
          <Spinner />
Severity: Major
Found in packages/db-kit/src/cli/decodeTransaction/Result.tsx and 2 other locations - About 2 hrs to fix
packages/db-kit/src/cli/decodeAddress/Result.tsx on lines 33..42
packages/db-kit/src/cli/decodeAddress/Result.tsx on lines 83..92

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

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 variablesElement = (
    <Box>
      <Box paddingLeft={1} paddingRight={1}>
        <Text color="green">
          <Spinner />
Severity: Major
Found in packages/db-kit/src/cli/decodeAddress/Result.tsx and 2 other locations - About 2 hrs to fix
packages/db-kit/src/cli/decodeAddress/Result.tsx on lines 33..42
packages/db-kit/src/cli/decodeTransaction/Result.tsx on lines 39..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 84.

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 summaryElement = (
    <Box>
      <Box paddingLeft={1} paddingRight={1}>
        <Text color="green">
          <Spinner />
Severity: Major
Found in packages/db-kit/src/cli/decodeAddress/Result.tsx and 2 other locations - About 2 hrs to fix
packages/db-kit/src/cli/decodeAddress/Result.tsx on lines 83..92
packages/db-kit/src/cli/decodeTransaction/Result.tsx on lines 39..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 84.

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

function callstack(state = [], action) {
  let newFrame;
  switch (action.type) {
    case actions.JUMP_IN:
      const {
Severity: Major
Found in packages/debugger/lib/stacktrace/reducers.js - About 2 hrs to fix

    Function processTarget has 61 lines of code (exceeds 25 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: Major
    Found in packages/external-compile/index.js - About 2 hrs to fix

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

        constructor(
          contract: Compilations.Contract,
          compilation: Compilations.Compilation,
          projectDecoder: ProjectDecoder,
          artifact?: Artifact
      Severity: Major
      Found in packages/decoder/lib/decoders.ts - About 2 hrs to fix

        Function sourceFromLocal has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async function sourceFromLocal(contractNameOrAddress, config) {
            if (
              contractNameOrAddress.startsWith("0x") &&
              !web3Utils.isAddress(contractNameOrAddress)
            ) {
        Severity: Major
        Found in packages/core/lib/commands/call/run.js - About 2 hrs to fix

          Function configureManagedGanache has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function configureManagedGanache(config, networkConfig, mnemonic) {
            const host = getFirstDefinedValue(
              networkConfig.host,
              "127.0.0.1" // Use as default host
            );
          Severity: Major
          Found in packages/core/lib/configAdapter.js - About 2 hrs to fix

            Function exports has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = async function (options) {
              const Config = require("@truffle/config");
              const OS = require("os");
            
              const log = options.logger
            Severity: Minor
            Found in packages/core/lib/commands/config/run.js - About 2 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 link has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              link: async function (library, destinations, deployer) {
                let eventArgs;
                let libraryName = library.contractName;
                if (libraryName == null && library.constructor) {
                  //allow for the possibility that library is an instance rather
            Severity: Minor
            Found in packages/deployer/src/linker.js - About 2 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 parse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            const parse = function (args) {
              if (args.length === 0) {
                return null;
              }
            
            
            Severity: Minor
            Found in packages/core/lib/commands/config/run.js - About 2 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 file has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            export function file(options: RequireOptions) {
              const sourceFilePath = path.resolve(options.file);
            
              expectOptions(options, ["file"]);
            
            
            Severity: Minor
            Found in packages/require/lib/index.ts - About 2 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 resolve has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              async resolve(importPath: string) {
                if (importPath === `truffle${path.sep}DeployedAddresses.sol`) {
                  const sourceFiles = await findContracts(this.options.contracts_directory);
            
                  const buildDirFiles: string[] = fse.existsSync(
            Severity: Minor
            Found in packages/resolver/lib/sources/truffle/index.ts - About 2 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 deploy has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              deploy: function (constructorABI) {
                const constructor = this;
                const web3 = constructor.web3;
            
                return function () {
            Severity: Major
            Found in packages/contract/lib/execute.js - About 2 hrs to fix

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

                getBlockByNumber(
                  blockNumber: string,
                  provider: Provider,
                  callback: Callback<JsonRPCResponse>
                ) {
              Severity: Major
              Found in packages/blockchain-utils/index.ts and 1 other location - About 2 hrs to fix
              packages/blockchain-utils/index.ts on lines 22..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 83.

              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 interface UseCompilationsOptions {
                config: TruffleConfig;
                db: Db;
                project: Resources.IdObject<"projects">;
                network: Pick<Resources.Input<"networks">, "name">;
              Severity: Major
              Found in packages/db-kit/src/cli/hooks/useCompilations.ts and 1 other location - About 2 hrs to fix
              packages/db-kit/src/cli/hooks/useDecoder.ts on lines 9..15

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

              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 interface UseDecoderOptions {
                config: TruffleConfig;
                db: Db;
                project: Resources.IdObject<"projects">;
                network: Pick<Resources.Input<"networks">, "name">;
              Severity: Major
              Found in packages/db-kit/src/cli/hooks/useDecoder.ts and 1 other location - About 2 hrs to fix
              packages/db-kit/src/cli/hooks/useCompilations.ts on lines 7..13

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

              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

                getBlockByHash(
                  blockHash: string,
                  provider: Provider,
                  callback: Callback<JsonRPCResponse>
                ) {
              Severity: Major
              Found in packages/blockchain-utils/index.ts and 1 other location - About 2 hrs to fix
              packages/blockchain-utils/index.ts on lines 5..20

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

              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

                  "compile:infos": [
                    function ({ infos }) {
                      if (this.quiet) return;
                      this.logger.log("> Compilation notices encountered:");
                      this.logger.log(`${OS.EOL}    ${infos.join()}`);
              Severity: Major
              Found in packages/events/defaultSubscribers/compile.js and 1 other location - About 2 hrs to fix
              packages/events/defaultSubscribers/compile.js on lines 49..55

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

              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

                  "compile:warnings": [
                    function ({ warnings }) {
                      if (this.quiet) return;
                      this.logger.log("> Compilation warnings encountered:");
                      this.logger.log(`${OS.EOL}    ${warnings.join()}`);
              Severity: Major
              Found in packages/events/defaultSubscribers/compile.js and 1 other location - About 2 hrs to fix
              packages/events/defaultSubscribers/compile.js on lines 56..62

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

              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

              Severity
              Category
              Status
              Source
              Language