relaton/relaton-cen

View on GitHub
lib/relaton_cen/cen_bibliography.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

      def bib_get(code, year, opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
        ref = year.nil? || code.match?(/:\d{4}/) ? code : "#{code}:#{year}"
        Util.info "Fetching from standards.cencenelec.eu ...", key: ref
        result = search_filter(code) || return
        ret = isobib_results_filter(result, year)
Severity: Minor
Found in lib/relaton_cen/cen_bibliography.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 isobib_results_filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def isobib_results_filter(result, year)
        missed_years = []
        result.each do |r|
          /:(?<pyear>\d{4})/ =~ r.hit[:code]
          if !year || year == pyear
Severity: Minor
Found in lib/relaton_cen/cen_bibliography.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 search_filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def search_filter(code) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
        parts = code_to_parts code
        result = search(code)
        result.select do |i|
          pts = code_to_parts i.hit[:code]
Severity: Minor
Found in lib/relaton_cen/cen_bibliography.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