lib/opal/nodes/call/require.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method handle_part has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

        def handle_part(sexp, missing_dynamic_require = @missing_dynamic_require)
          if sexp
            case sexp.type
            when :str
              return sexp.children[0]
Severity: Minor
Found in lib/opal/nodes/call/require.rb - 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

Method handle_part has 32 lines of code (exceeds 30 allowed). Consider refactoring.
Open

        def handle_part(sexp, missing_dynamic_require = @missing_dynamic_require)
          if sexp
            case sexp.type
            when :str
              return sexp.children[0]
Severity: Minor
Found in lib/opal/nodes/call/require.rb - About 1 hr to fix

    Avoid too many return statements within this method.
    Open

                    return File.dirname(Opal::Compiler.module_name(@compiler.file))
    Severity: Major
    Found in lib/opal/nodes/call/require.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                        return expand_path parts.join('/')
      Severity: Major
      Found in lib/opal/nodes/call/require.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                          return expand_path parts[0].split('/')[0...-1].join('/')
        Severity: Major
        Found in lib/opal/nodes/call/require.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                            return expand_path(*parts)
          Severity: Major
          Found in lib/opal/nodes/call/require.rb - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status