Showing 143 of 143 total issues
Method initialize_top_tracks_by_lastfm
has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring. Open
def self.initialize_top_tracks_by_lastfm(lastfm, user, year = nil)
lastfm_user_name, working_tracks, missing_tracks, lastfm_albums = user.lastfm_user_name, [], [], {}
year_in_reviews = {}
1000.times do |page|
- 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 initialize_top_releases_by_lastfm
has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring. Open
def self.initialize_top_releases_by_lastfm(lastfm, user, year = nil)
lastfm_user_name, working_releases, missing_releases = user.lastfm_user_name, [], []
year_in_reviews = {}
1000.times do |page|
- 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 import_music_artists
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def import_music_artists(lastfm, start_page = 1)
artist_names, artist_mbids = [], []
1000.times do |page|
page +=1
- 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 track_creation
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
def track_creation(from, name = nil)
name_and_mbid = params[:music_track].delete(:name_and_mbid)
@track.name = name || MusicTrack.format_name(name_and_mbid.split(';').first)
if @track.name.length > 255
- 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 up
has 165 lines of code (exceeds 25 allowed). Consider refactoring. Open
def up
MongoDatabaseCleaner.clean
create_table :users do |t|
t.string :name
File schema.rb
has 432 lines of code (exceeds 250 allowed). Consider refactoring. Open
ActiveRecord::Schema.define(version: 20150811104835) do
create_table "areas", force: :cascade do |t|
t.string "ancestry", limit: 255
t.integer "ancestry_depth", limit: 4, default: 0
Method confirm_artist
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def confirm_artist(from)
build_artist
if @artist.mbid.present?
musicbrainz_artist = MusicBrainz::Artist.find(@artist.mbid)
- 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 release_groups
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def release_groups(musicbrainz_artist, voluntary_releases, offset, without_limitation, with_releases = false)
musicbrainz_artist = MusicBrainz::Artist.find(mbid) unless musicbrainz_artist
count = 100
working_release_groups = musicbrainz_artist.release_groups(extra_query: 'AND (type:album OR type:ep OR type:soundtrack)', offset: offset)
count = working_release_groups.total_count
- 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 multiple_new
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def multiple_new
if params[:commit].present?
@user = current_user
find_year_in_review
@tracks = current_user.music_tracks.for_year_in_review(@year_in_review)
- 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 set_cache_columns
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def set_cache_columns
unless !respond_to?(:user_id) || user_id.present?
self.user_id = year_in_review_music.user_id
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
File music_release.rb
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
class MusicRelease < ActiveRecord::Base
include LastfmRequest
SECONDARY_TYPES_BLACKLIST = ['Audiobook', 'Compilation', 'DJ-mix', 'Interview', 'Live', 'Remix', 'Spokenword', 'Mixtape/Street']
Method redirect_after_artist_available
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def redirect_after_artist_available(from)
if !@artist.persisted?
render :new
elsif ['new_artist', 'new_release', 'new_track', 'new_video'].include?(from) # && @artist.active?
working_params = {}
- 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 set_cache_columns
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def set_cache_columns
unless !respond_to?(:user_id) || user_id.present?
self.user_id = year_in_review_music.user_id
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 initialize_top_tracks_by_lastfm
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.initialize_top_tracks_by_lastfm(lastfm, user, year = nil)
lastfm_user_name, working_tracks, missing_tracks, lastfm_albums = user.lastfm_user_name, [], [], {}
year_in_reviews = {}
1000.times do |page|
Method code
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.code
Proc.new do |navigation|
navigation.items do |primary|
primary.dom_class = 'nav'
- 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 is_bonus_track?
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def is_bonus_track?
return false if ::MusicTrack.name_included_in_bonustrack_blacklist?(name)
tracks = MusicBrainz::Recording.search(artist_mbid ? artist_mbid : artist.mbid, name, limit: 100).select{|t| MusicTrack.format_name(t[:title]).downcase == name.downcase.strip }
- 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 create_from_table
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def create_from_table(model_name, table, extra = {})
factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym
is_singular = model_name.to_s.singularize == model_name.to_s
hashes = if is_singular
- 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 import_artists_of_group_members
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def import_artists_of_group_members(options = {})
last_page = options[:last_page]
last_user_name_from_last_run = options[:last_user_name_from_last_run]
library_start_page = options[:library_start_page]
- 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 initialize_top_releases_by_lastfm
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.initialize_top_releases_by_lastfm(lastfm, user, year = nil)
lastfm_user_name, working_releases, missing_releases = user.lastfm_user_name, [], []
year_in_reviews = {}
1000.times do |page|
Method by_name
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def by_name
if params[:artist_name].blank? || params[:name].blank?
flash[:alert] = I18n.t('music_videos.by_name.artist_name_or_name_blank')
redirect_to music_videos_path(artist_name: params[:artist_name], name: params[:name]) and return
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"