rharriso/bower-rails

View on GitHub
lib/bower-rails/performer.rb

Summary

Maintainability
C
1 day
Test Coverage

Method remove_extra_files has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_extra_files
      puts "\nAttempting to remove all but main files as specified by bower\n"

      Dir["#{components_directory}/*"].each do |component_dir|
        component_name = component_dir.split('/').last
Severity: Minor
Found in lib/bower-rails/performer.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 perform_command has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def perform_command(remove_components = true, &block)
      # Load in bower json file
      txt  = File.read(File.join(root_path, "bower.json"))
      json = JSON.parse(txt)

Severity: Minor
Found in lib/bower-rails/performer.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 perform_command has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def perform_command(remove_components = true, &block)
      # Load in bower json file
      txt  = File.read(File.join(root_path, "bower.json"))
      json = JSON.parse(txt)

Severity: Minor
Found in lib/bower-rails/performer.rb - About 1 hr to fix

    Method perform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def perform(remove_components = true, &block)
          npm_path = File.join(root_path, 'node_modules', '.bin')
          bower = find_command('bower', [npm_path])
    
          if bower.nil?
    Severity: Minor
    Found in lib/bower-rails/performer.rb - About 1 hr 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 find_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_command(cmd, paths = [])
          exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
          paths += ENV['PATH'].split(File::PATH_SEPARATOR)
          paths.each do |path|
            exts.each do |ext|
    Severity: Minor
    Found in lib/bower-rails/performer.rb - About 25 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

    There are no issues that match your filters.

    Category
    Status