hammernight/taza

View on GitHub

Showing 4 of 4 total issues

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

    def create
      template('templates/project/Gemfile.tt', 'Gemfile') unless File.exists? 'Gemfile'
      template('templates/project/Rakefile.tt', 'Rakefile') unless File.exists? 'Rakefile'
      template('templates/project/config.yml.tt', 'config/config.yml') unless File.exists? 'config/config.yml'
      empty_directory 'lib/sites'
Severity: Minor
Found in lib/taza/generators/project_generator.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 check_filters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_filters(params) # :nodoc:
      params[:filters].each do |filter_method|
        unless @active_filters.include?(filter_method)
          @active_filters << filter_method
          raise FilterError, "#{filter_method} returned false for #{params[:element_name]}" unless send(filter_method)
Severity: Minor
Found in lib/taza/page.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

Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(params={},&block)
      @module_name = self.class.to_s.split("::").first
      @class_name  = self.class.to_s.split("::").last
      define_site_pages
      define_flows
Severity: Minor
Found in lib/taza/site.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

Method element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.element(name,&block)
      if name.nil?
        raise ElementError, "Element name can not be nil"
      end

Severity: Minor
Found in lib/taza/page.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

Severity
Category
Status
Source
Language