maintux/wp-fire

View on GitHub

Showing 5 of 5 total issues

Method compile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def self.compile(filename, build_path, root_path, raise_on_exception=false)
      extname = File.extname(filename)
      basename = File.basename(filename, extname)
      if not basename[0].eql?"_" and extname.eql?".scss"
        sass_engine = Sass::Engine.for_file filename, {}
Severity: Minor
Found in lib/wp_fire/compiler.rb - 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

Method compile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.compile(filename, build_path, root_path, raise_on_exception=false)
      extname = File.extname(filename)
      basename = File.basename(filename, extname)
      if not basename[0].eql?"_" and extname.eql?".scss"
        sass_engine = Sass::Engine.for_file filename, {}
Severity: Minor
Found in lib/wp_fire/compiler.rb - About 1 hr to fix

    Method execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute
          @assets_path = File.join(dir,"source","assets")
          @templates_path = File.join(dir,"source","templates")
          @functions_path = File.join(dir,"source","functions")
    
    
    Severity: Minor
    Found in lib/wp_fire/main_command.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_scss_parents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.find_scss_parents(filename,parents_array)
          directory = File.dirname(filename)
          Dir["#{directory}/*.scss"].each do |f|
            if open(f).grep(/@import ["']#{File.basename(filename).gsub(/(_|\.scss)/,'')}["']/).any?
              if File.basename(f)[0].eql?"_" and not f.eql? filename
    Severity: Minor
    Found in lib/wp_fire/compiler.rb - About 45 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

    Method render_directory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def render_directory(source, target)
          Dir.glob("#{source}/**/*") do |file|
            unless File.directory?(file)
              source_file = file.gsub(source, '')
              target_file = File.join(target, source_file)
    Severity: Minor
    Found in lib/wp_fire/generator.rb - 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