relaton/relaton-ietf

View on GitHub
lib/relaton_ietf/data_fetcher.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def update_versions(versions) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
      series = ""
      bib_versions = []
      Dir["#{@output}/*.#{@ext}"].each do |file|
        match = /(?<series>draft-.+)-(?<ver>\d{2})\.#{@ext}$/.match file
Severity: Minor
Found in lib/relaton_ietf/data_fetcher.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 save_doc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def save_doc(entry, check_duplicate: true) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
      return unless entry

      c = case @format
          when "xml" then entry.to_xml(bibdata: true)
Severity: Minor
Found in lib/relaton_ietf/data_fetcher.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 fetch_ieft_internet_drafts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def fetch_ieft_internet_drafts # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
      versions = Dir["bibxml-ids/*.xml"].each_with_object([]) do |path, vers|
        file = File.basename path, ".xml"
        if file.include?("D.draft-")
          vers << file.sub(/^reference\.I-D\./, "").downcase
Severity: Minor
Found in lib/relaton_ietf/data_fetcher.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