Showing 65 of 103 total issues
Method merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def merge(new_values, overwrite = false, object = self)
new_values.each do |key, value|
value.strip! if value.is_a? String
# REVIEW
# We can have various strategies here
- Read upRead up
- Create a ticketCreate a ticket
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 bodify_collate
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def bodify_collate(source_text, target_text, source_lang, books = [], books_citation_style = 'citation.book.inline_annotated_html', links_citation_style = 'citation.link.inline_annotated_html', annotated = true)
- Create a ticketCreate a ticket
Method larger_cut_image_location
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def larger_cut_image_location(aspect_x, aspect_y, width, snap, gravity, effects, total_columns)
- Create a ticketCreate a ticket
Method add_task
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.add_task(isbn_candidate)
isbn_candidate.gsub!(/[^\dX]/, '')
book = where(isbn_10: isbn_candidate).first_or_create if isbn_candidate.length == 10
book = where(isbn_13: isbn_candidate).first_or_create if isbn_candidate.length == 13
if book && book.dirty?
- Read upRead up
- Create a ticketCreate a ticket
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 cut_location
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def cut_location(aspect_x, aspect_y, width, snap, gravity, effects = '')
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (element === polyline[0]) {
strokeColor = element.strokeColor || this.polylines_conf.strokeColor;
strokeOpacity = element.strokeOpacity || this.polylines_conf.strokeOpacity;
strokeWeight = element.strokeWeight || this.polylines_conf.strokeWeight;
clickable = element.clickable || this.polylines_conf.clickable;
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (element === polyline[0]) {
strokeColor = element.strokeColor || this.polylines_conf.strokeColor;
strokeOpacity = element.strokeOpacity || this.polylines_conf.strokeOpacity;
strokeWeight = element.strokeWeight || this.polylines_conf.strokeWeight;
clickable = element.clickable || this.polylines_conf.clickable;
- Create a ticketCreate a ticket
Function createMarkerImage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Gmaps4RailsMapquest.prototype.createMarkerImage = function(markerPicture, markerSize, origin, anchor, scaledSize) {};
- Create a ticketCreate a ticket
Method syncdown_note_failed
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def syncdown_note_failed(provider, guid, title, username, error = 'failed')
- Create a ticketCreate a ticket
Method blurbify
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def blurbify(text, books = [], books_citation_style = 'citation.book.inline_unlinked_html', links_citation_style = 'citation.link.inline_unlinked_html', strip_tags = true)
- Create a ticketCreate a ticket
Method blurb
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def blurb(main_title, subtitle, clean_body, introduction = nil, blurb_length = NB.blurb_length.to_i, omission: NB.blurb_omission)
- Create a ticketCreate a ticket
Method bodify
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def bodify(text, books = [], books_citation_style = 'citation.book.inline_annotated_html', links_citation_style = 'citation.link.inline_annotated_html', annotated = true)
- Create a ticketCreate a ticket
Function createMarkerImage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Gmaps4RailsGoogle.prototype.createMarkerImage = function(markerPicture, markerSize, origin, anchor, scaledSize) {
- Create a ticketCreate a ticket
Method index
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def index
page_number = params[:page] ||= 1
all_citations = Note.citation.publishable
@citations = all_citations.page(page_number).per(NB.citations_index_per_page.to_i).load
- Read upRead up
- Create a ticketCreate a ticket
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 tweet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.tweet(text)
# Replace @ and # characters before tweeting to avoid spamming other users
# These characters are unchanged as far as Pantography itself goes; they are stored intact.
text = self.unspamify(text)
tweet = authenticated_twitter_client.update(text)
- Read upRead up
- Create a ticketCreate a ticket
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 crop_offsets_by_gravity
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def crop_offsets_by_gravity(gravity, original_dimensions, cropped_dimensions)
fail(ArgumentError, "Gravity must be one of #{GRAVITY_TYPES.inspect}") unless GRAVITY_TYPES.include?(gravity.to_sym)
fail(ArgumentError, 'Original dimensions must be supplied as a [ width, height ] array') unless original_dimensions.is_a?(Enumerable) && original_dimensions.size == 2
fail(ArgumentError, 'Cropped dimensions must be supplied as a [ width, height ] array') unless cropped_dimensions.is_a?(Enumerable) && cropped_dimensions.size == 2
- Read upRead up
- Create a ticketCreate a ticket
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 sync_binary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sync_binary
unless File.file?(raw_location)
NB.stream_binaries == 'true' ? stream_binary : download_binary
# Check that the resource has been downloaded correctly. If so, unflag it.
if Digest::MD5.file(raw_location).digest == data_hash
- Read upRead up
- Create a ticketCreate a ticket
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 discard_versions?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def discard_versions?
if has_instruction?('reset')
self.external_updated_at = external_created_at if NB.always_reset_on_create == 'true'
versions.destroy_all unless versions.empty?
end
- Read upRead up
- Create a ticketCreate a ticket
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 populate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def populate(response)
response = response['data'].first
metadata = {}
metadata['title'] = response.try { |r| r['title'].titlecase }
- Read upRead up
- Create a ticketCreate a ticket
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 skipped
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.skipped(text)
# Calculate the number of pantographs that have been skipped due to repeated spaces.
# This is basically a triangular function on the length of the string - 1.
# So, for a string that is five letters long, we do 4 + 3 + 2 + 1.
return 0 if text.length == 1 && alphabet.index(text.last) > alphabet.index(' ')
- Read upRead up
- Create a ticketCreate a ticket
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"