Showing 54 of 66 total issues
Class Show
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
class Show < ApplicationRecord
include ShowScopesConcern
include LikeableConcern
include TanoshimuUtils::Concerns::RespondToTypes
include TanoshimuUtils::Concerns::ResourceFetch
File show.rb
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'active_storage'
class Show < ApplicationRecord
include ShowScopesConcern
include LikeableConcern
File episodes.js
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
$(document).ready(function() {
// Global variables
var goingToShow = false;
var goingToEpisode = false;
var fullscreenOn = false;
Function login
has 93 lines of code (exceeds 25 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) {
Function Config
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
var Config = (function() {
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
- 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
Class BaseCategory
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseCategory
LAYOUTS = %i(
simple
expanded
).freeze
Function fetchComments
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function fetchComments() {
$.ajax({
type: 'get',
data: 'usernames=true',
url: '/json/episodes/get_comments?id=' + episodeId,
- 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 exports
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Function fetchComments
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetchComments() {
$.ajax({
type: 'get',
data: 'usernames=true',
url: '/json/episodes/get_comments?id=' + episodeId,
Method create_or_update_show_for
has 46 lines of code (exceeds 25 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?
Function Config
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Config = (function() {
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
Method fetch_all_shows
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def fetch_all_shows
shows = []
@current_page = 1
loop do
- 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 success
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function(message) {
if (message.err) {
console.log('Could not retrieve the comments: ' + message.err);
commentTitle.html('Comments are unavailable.');
} else {
Method badges
has 37 lines of code (exceeds 25 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?
Method compute_shows
has a Cognitive Complexity of 12 (exceeds 5 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
- 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 createMenuItem
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createMenuItem(id, lang, label) {
var listItem = document.createElement('li');
var button = listItem.appendChild(document.createElement('button'));
button.setAttribute('id', id);
Method crawl_shows
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def crawl_shows
raise 'Crawling is not allowed.' unless Rails.configuration.allows_crawling
@current_url = "https://kitsu.io/api/edge/anime?page%5Blimit%5D=20&page%5Boffset%5D=0"
@has_next = 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 airing_status_for
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def airing_status_for(show, default: 'unknown')
return default if show.starts_on.blank?
today_s_date = DateTime.now.utc
if show.starts_on < today_s_date
- 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_streaming_platforms_from_anilist
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fetch_streaming_platforms_from_anilist
Rails.logger.info("[Shows::Anilist::Streamers] GET graphql.anilist.co: ANIME(##{anilist_id})")
data = fetch_data!.dig(:data, :Media)
return unless data.present?
- 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 detect_from
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.detect_from(urls_or_names)
urls_or_names = Array(urls_or_names) unless urls_or_names.is_a?(Array)
names = urls_or_names.map do |url_or_name|
if url_or_name.is_a?(String) || url_or_name.is_a?(Symbol)
- 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"