trufflesuite/truffle

View on GitHub

Showing 685 of 1,401 total issues

DebugPrinter has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class DebugPrinter {
  constructor(config, session) {
    this.config = config;
    this.session = session;
    this.select = expr => {
Severity: Minor
Found in packages/core/lib/debug/printer.js - About 2 hrs to fix

    File index.ts has 277 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import WebSocket from "isomorphic-ws";
    
    // must polyfill AbortController to use axios >=0.20.0, <=0.27.2 on node <= v14.x
    import "../polyfill";
    import axios from "axios";
    Severity: Minor
    Found in packages/dashboard-message-bus-client/lib/connection/index.ts - About 2 hrs to fix

      Function get has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            get() {
              let networkConfig;
              try {
                networkConfig = configObject.network_config;
              } catch {
      Severity: Major
      Found in packages/config/src/configDefaults.ts - About 2 hrs to fix

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

        import debugModule from "debug";
        const debug = debugModule("debugger:sourcemapping:selectors");
        
        import { createSelectorTree, createLeaf } from "reselect-tree";
        import SourceMapUtils from "@truffle/source-map-utils";
        Severity: Minor
        Found in packages/debugger/lib/sourcemapping/selectors/index.js - About 2 hrs to fix

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

          import debugModule from "debug";
          const debug = debugModule("debugger:web3:sagas");
          
          import {
            all,
          Severity: Minor
          Found in packages/debugger/lib/web3/sagas/index.js - About 2 hrs to fix

            Function resolver has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                  (sources, functions) => breakpoint => {
                    let adjustedBreakpoint;
                    if (breakpoint.node === undefined) {
                      let line = breakpoint.line;
                      if (line < 0) {
            Severity: Minor
            Found in packages/debugger/lib/controller/selectors/index.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 getProcessedInstructionsForBinary has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              getProcessedInstructionsForBinary: function (sources, binary, sourceMap) {
                if (!sources || !binary) {
                  return [];
                }
                debug("sourceMap: %O", sourceMap);
            Severity: Major
            Found in packages/source-map-utils/index.js - About 2 hrs to fix

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

                constructor(
                  projectEncoder: ProjectEncoder,
                  compilation: Codec.Compilations.Compilation,
                  contract: Codec.Compilations.Contract,
                  artifact?: Artifact
              Severity: Major
              Found in packages/encoder/lib/encoders.ts - About 2 hrs to fix

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

                  constructor(
                    compilations: Compilations.Compilation[],
                    provider: Provider,
                    ensSettings?: DecoderTypes.EnsSettings,
                    selectorDirectory?: DecoderTypes.SelectorDirectorySettings
                Severity: Major
                Found in packages/decoder/lib/decoders.ts - About 2 hrs to fix

                  Function decodeTransactionBySelector has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private async decodeTransactionBySelector(
                      transaction: DecoderTypes.Transaction,
                      data: Uint8Array, //this is redundant but included for convenience
                      additionalContexts: Contexts.Contexts,
                      context: Contexts.Context | null
                  Severity: Major
                  Found in packages/decoder/lib/decoders.ts - About 2 hrs to fix

                    Function file has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function file(options: RequireOptions) {
                      const sourceFilePath = path.resolve(options.file);
                    
                      expectOptions(options, ["file"]);
                    
                    
                    Severity: Major
                    Found in packages/require/lib/index.ts - About 2 hrs to fix

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

                      const debug = require("debug")("compile-vyper");
                      const path = require("path");
                      const exec = require("child_process").exec;
                      const fs = require("fs");
                      const colors = require("colors");
                      Severity: Minor
                      Found in packages/compile-vyper/index.js - About 2 hrs to fix

                        Function printInstruction has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          printInstruction(locations = this.locationPrintouts) {
                            const instruction = this.session.view(sourcemapping.current.instruction);
                            const instructions = this.session.view(sourcemapping.current.instructions);
                            const step = this.session.view(trace.step);
                            const traceIndex = this.session.view(trace.index);
                        Severity: Major
                        Found in packages/core/lib/debug/printer.js - About 2 hrs to fix

                          Function editedLines has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            const editedLines = source.contents.split("\n").map((line, index) => {
                              if (line.length === 0) {
                                return line;
                              }
                              const { start, end } = sourceRange;

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

                            import debugModule from "debug";
                            const debug = debugModule("debugger:txlog:selectors");
                            
                            import { createSelectorTree, createLeaf } from "reselect-tree";
                            
                            
                            Severity: Minor
                            Found in packages/debugger/lib/txlog/selectors/index.js - About 2 hrs to fix

                              ContractInstanceDecoder has 23 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              export class ContractInstanceDecoder {
                                private providerAdapter: ProviderAdapter;
                              
                                private compilation: Compilations.Compilation;
                                private contract: Compilations.Contract;
                              Severity: Minor
                              Found in packages/decoder/lib/decoders.ts - About 2 hrs to fix

                                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 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 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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language