citation-file-format/ruby-cff

View on GitHub

Showing 11 of 11 total issues

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

    def fields_to_hash(fields)
      hash = {}

      fields.each do |field, value|
        if value.respond_to?(:map)
Severity: Minor
Found in lib/cff/util.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 publication_data_from_model has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.publication_data_from_model(model) # rubocop:disable Metrics
        case model.type
        when 'article'
          [
            model.journal,
Severity: Minor
Found in lib/cff/formatters/apalike.rb - About 1 hr to fix

    Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(param, *more) # rubocop:disable Metrics
          super()
    
          if param.is_a?(Hash)
            @fields = build_model(param)
    Severity: Minor
    Found in lib/cff/reference.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(param = nil, *more)
          super()
    
          if param.is_a?(Hash)
            @fields = param
    Severity: Minor
    Found in lib/cff/identifier.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 month_and_year_from_model has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.month_and_year_from_model(model)
            if model.type == 'conference-paper' && !model.conference.empty?
              start = model.conference.date_start
              unless start == ''
                finish = model.conference.date_end
    Severity: Minor
    Found in lib/cff/formatters/apalike.rb - About 55 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 publication_data_from_model has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.publication_data_from_model(model) # rubocop:disable Metrics
            case model.type
            when 'article'
              [
                model.journal,
    Severity: Minor
    Found in lib/cff/formatters/apalike.rb - About 55 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 format has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.format(model:, preferred_citation: true) # rubocop:disable Metrics
            model = select_and_check_model(model, preferred_citation)
            return if model.nil?
    
            values = {}
    Severity: Minor
    Found in lib/cff/formatters/bibtex.rb - About 55 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(param)
          super()
    
          if param.is_a?(Hash)
            @fields = build_index(param)
    Severity: Minor
    Found in lib/cff/index.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(param = nil, *more)
          super()
    
          if param.is_a?(Hash)
            @fields = param
    Severity: Minor
    Found in lib/cff/person.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 format_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.format_name(author)
            if author.family_names.empty?
              if author.given_names.empty?
                author.alias
              else
    Severity: Minor
    Found in lib/cff/formatters/apalike.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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def method_missing(name, *args)
          n = method_to_field(name.id2name)
          super unless self.class::ALLOWED_FIELDS.include?(n.chomp('='))
    
          if n.end_with?('=')
    Severity: Minor
    Found in lib/cff/model_part.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