matkoniecz/CartoCSSHelper

View on GitHub
lib/cartocss_helper/validator.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method check_missing_names has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def check_missing_names(tags, zlevel, interactive = false, on_water = false)
      not_required = CartoCSSHelper::Configuration.get_style_specific_data.name_label_is_not_required
      return if not_required.include?(tags)
      ['node', 'closed_way', 'way'].each do |type|
        next if not_required.include?(tags.merge({ type: type }))
Severity: Minor
Found in lib/cartocss_helper/validator.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_unwanted_names has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def check_unwanted_names(tags, zlevel, interactive = false, on_water = false)
      ['node', 'closed_way', 'way'].each do |type|
        not_required = CartoCSSHelper::Configuration.get_style_specific_data.name_label_is_not_required
        next unless not_required.include?(tags) || not_required.include?(tags.merge({ type: type }))
        unless is_object_displaying_anything_as_this_object_type tags, zlevel, on_water, type
Severity: Minor
Found in lib/cartocss_helper/validator.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 compare_expected_with_tag_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def compare_expected_with_tag_data(list_of_expected, tag_info)
      list_of_expected.each do |expected|
        next unless expected.key == tag_info.key
        next unless expected.value == tag_info.value
        if expected.equal? tag_info
Severity: Minor
Found in lib/cartocss_helper/validator.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_dy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def check_dy(tags, zlevel, interactive = false, on_water = false)
      unless is_object_displaying_anything_as_node tags, zlevel, on_water
        # puts key+"="+value+" - not displayed as node on z#{zlevel}"
        return
      end
Severity: Minor
Found in lib/cartocss_helper/validator.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 is_object_displaying_name_as_this_object_type has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def is_object_displaying_name_as_this_object_type(tags, name, zlevel, on_water, type)
Severity: Minor
Found in lib/cartocss_helper/validator.rb - About 35 mins to fix

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

        def ensure_that_all_documented_are_really_rendered(list_of_documented, list_of_rendered)
          list_of_documented.each do |documented|
            if Info.get_expected_state(documented.key, documented.value) == :ignored
              next
            end
    Severity: Minor
    Found in lib/cartocss_helper/validator.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 is_tag_documented has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def is_tag_documented(list, key, value)
          list.each do |tag_info|
            next unless key == tag_info.key
            return true if value == tag_info.value
          end
    Severity: Minor
    Found in lib/cartocss_helper/validator.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