Showing 54 of 66 total issues
Function login
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function login(error_p_id, waiting_p_id, success_p_id, form_id, callback) {
function edForm(form, readOnly) {
if (form && form.elements) {
var elements = form.elements;
[].forEach.call(elements, function(e) {
- 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 compute_shows
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute_shows
default_scope = self.class.default_scope
if default_scope.is_a?(Array)
Rails.logger.warn('Ignoring #scopes due to default scope being an array')
return default_scope
Method link_for
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def link_for(site, url)
if site.downcase =~ /official site/
method = persist ? :create! : :new
ShowUrl.send(method, url_type: :official, value: url, show: show)
else
- 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_or_update_show_for
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_or_update_show_for(data, airing_status, show_obj: nil)
fetched_attrs = data[:attributes]
synched_show = show_obj.present? ? show_obj : find_show_from_attributes(fetched_attrs)
if synched_show.persisted?
- 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 update_banner_and_poster_urls!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_banner_and_poster_urls!(**options)
force = options[:force] || false
return nil unless persisted?
if !force
return true if poster_url? && banner_url?
- 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
Avoid deeply nested control flow statements. Open
if (episode.ratio !== undefined) {
var progressBar = $('div#progress_' + id);
ratioInfo = 'width: ' + parseInt(episode.ratio) + '%;';
progressBar.attr('style', ratioInfo);
progressBar.removeClass('hidden');
Method sync_show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sync_show
raise '`show` params is mandatory with sync_type: :show' unless show.present?
return unless show.synchable?
response = RestClient.get(request_show_url(show))
- 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 perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perform
Show.published.each do |show|
next unless show.synchable? && show.reference_source == 'kitsu'
Shows::Kitsu::Get.perform(
- 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
Function goToNextId
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function goToNextId(currentId) {
console.log("Going to the next episode if any...");
$.ajax({
type: 'get',
url: '/json/get/episode/next?id=' + currentId + "&check_setting=true",
- 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 badges
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def badges
options = []
options << badge_options
options << { type: :light, text: t("anime.shows.airing_status.#{@show.status}") } unless @show.air_complete?
- 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
Function login
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function login(error_p_id, waiting_p_id, success_p_id, form_id, callback) {
Method override_episodes_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def override_episodes_for(show)
#::Sync::Shows::ReactionCountJob.perform_later(show)
return if show.reference_id.blank?
response = RestClient.get(request_episodes_url(show))
- 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 sort_filters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.sort_filters(*filters)
scope = all
filters.map do |filter|
scope = if filter.use_scope
scope = scope.send(filter.use_scope)
- 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 fetch_arg_from_args
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fetch_arg_from_args(job, klass, type)
job.arguments.each do |arg|
return arg if arg.is_a?(klass)
if arg.is_a?(Hash)
- 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 perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform
show = Show.find_kitsu(kitsu_id)
show = if show.present?
needs_update?(show) ? update_show_from_kitsu!(show) : show
else
- 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 perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform
return if show.blank?
return unless anilist_id.present?
return if show.air_complete?
- 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 find_user_from_token
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_user_from_token(token)
Rails.logger.info("Fetching token info...")
response = RestClient.get(
"https://id.youranime.moe/me.json",
{ 'Authorization' => "Bearer #{token}" }
- 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_shows_then_next_page
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_shows_then_next_page(season)
Rails.logger.info("[Shows::Sync] #{request_airing_url(season)}")
there_is_data = true
created_shows = []
- 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
Avoid too many return
statements within this method. Open
return current_next_airing_info.up_to_date!
Avoid too many return
statements within this method. Open
return sync_shows if sync_type == :shows