lib/relaton_bib/renderer/bibtex_builder.rb
Class BibtexBuilder
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
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
Method to_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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
- Read upRead up
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
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")
- Read upRead up
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"