relaton/relaton-bib

View on GitHub
lib/relaton_bib/renderer/bibtex_builder.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class BibtexBuilder has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

    class BibtexBuilder
      ATTRS = %i[
        type id title author editor booktitle series number edition contributor
        date address note relation extent classification keyword docidentifier
        timestamp link
Severity: Minor
Found in lib/relaton_bib/renderer/bibtex_builder.rb - About 3 hrs to fix

    Method to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_s(options = {}) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
          if options.key?(:filter)
            opts = options.reject { |k,| k == :filter || (k == :quotes && (!atomic? || symbol?)) }
            return convert(options[:filter]).to_s(opts)
          end
    Severity: Minor
    Found in lib/relaton_bib/renderer/bibtex_builder.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 add_contributor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_contributor # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
            @bib.contributor.each do |c|
              rls = c.role.map(&:type)
              if rls.include?("publisher") then @item.publisher = c.entity.name
              elsif rls.include?("distributor")
    Severity: Minor
    Found in lib/relaton_bib/renderer/bibtex_builder.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