paramadeep/pageify

View on GitHub

Showing 3 of 5 total issues

Method match_fields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def match_fields field 
      field.each do|key,value|
        element = page.find(get_selector(key))
        if element.tag_name == 'input' && element[:type] == 'checkbox'
          value == 'true' ? element.should(be_checked) : element.should_not(be_checked)
Severity: Minor
Found in lib/pageify/capybara/bulk_actions.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 createChild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def createChild (raw_row)
      child = PageObject.create(raw_row)
      child.parent = self
      define_singleton_method(child.name) do |*arguments|
        unless arguments.eql? []
Severity: Minor
Found in lib/pageify/page_object.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 to_page_objects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def to_page_objects(file)
    rawArray = get_procesed(file)
    parentElement = rawArray.shift
    page = createElement(parentElement)
    parent = [page]
Severity: Minor
Found in lib/pageify.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