Showing 37 of 43 total issues
Method create
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def create
items = {}
track_id = request.POST[:track_id]
nickname = request.POST[:nickname].to_s.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 index
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def index
items = []
timeout = 60.seconds
CacheLock.synchronize(:playlist) 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
Method create
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
items = {}
track_id = request.POST[:track_id]
nickname = request.POST[:nickname].to_s.strip
Class ApplicationController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :set_locale!
Method index
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
items = []
timeout = 60.seconds
CacheLock.synchronize(:playlist) do
Method fetch
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def fetch
set_site_title(I18n.t('upload.niconico.title'))
@track = Track.new(track_params)
if @track.niconico.empty?
flash.now[:error] = I18n.t('upload.niconico.blank_niconico_id')
- 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_or_create
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_or_create
set_site_title(I18n.t('navbar.catalog'))
@catalog_old = Catalog.order(id: :desc).limit(1).first
@catalog_new = Catalog.new(catalog_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 fetch
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch
set_site_title(I18n.t('upload.niconico.title'))
@track = Track.new(track_params)
if @track.niconico.empty?
flash.now[:error] = I18n.t('upload.niconico.blank_niconico_id')
Method update
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
secret_key = request.POST[:secret_key]
szhash = request.POST[:szhash] || request.POST[:hash]
if secret_key != $BRIDGE_SECRET_KEY
render nothing: true, status: :forbidden and return
Method show
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
#set_site_title("#{I18n.t('upload.asin.title')}『#{asin_id}』")
@items = []
flash.now[:error] = 'invalid_amazon_asin' and return if (/^[A-Z0-9]{10}$/ =~ asin_id) == nil
Method update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def update
secret_key = request.POST[:secret_key]
szhash = request.POST[:szhash] || request.POST[:hash]
if secret_key != $BRIDGE_SECRET_KEY
render nothing: true, status: :forbidden and return
- 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
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
set_site_title(I18n.t('admin.notices.notification_management'))
ids = request.POST[:id].to_a
datelines = request.POST[:dateline].to_a
Method update_or_create
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_or_create
set_site_title(I18n.t('navbar.catalog'))
@catalog_old = Catalog.order(id: :desc).limit(1).first
@catalog_new = Catalog.new(catalog_params)
Method create
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
set_site_title(I18n.t('issues.new_issue'))
@typeids ||= ['question', 'suggestion', 'appeal']
dateline = Time.now.utc
Method show
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@item = {}
@item_replies = []
id = params[:id]
issue = Issue.where(id: id).first
Method show
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show
#set_site_title("#{I18n.t('upload.asin.title')}『#{asin_id}』")
@items = []
flash.now[:error] = 'invalid_amazon_asin' and return if (/^[A-Z0-9]{10}$/ =~ asin_id) == nil
- 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
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import
attachment = params[:attachment]
items = JSON.parse(attachment.read)
destroy_all = request.POST[:destroy_all]
Method append
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def append
id = params[:id]
issue = Issue.where(id: id).first
dateline = Time.now.utc
Method create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
set_site_title("#{I18n.t('navbar.images')}##{track_id}")
userip = @client[:ip]
@track = Track.find(track_id)
@image = @track.images.build(image_params)
Method update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update
id = params[:id]
issue_id = request.POST[:issue_id].to_i
issue_status = request.POST[:issue_status].to_s
- 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"