Showing 377 of 529 total issues
Method hash_for_group
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def hash_for_group(group, with = nil)
h = {
type: group.type,
id: group.id,
name: group.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"
Further reading
Function PageViewport
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
Function setTransform
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
Avoid deeply nested control flow statements. Open
if (mask === 0) {
srcByte = src[srcPos++];
mask = 128;
}
Avoid deeply nested control flow statements. Open
for (var i = 0; i < dashArrayLength; i++) {
var validNumber = (+dashArray[i] >= 0);
if (!validNumber) {
isInvalid = true;
break;
Function createMeshCanvas
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function createMeshCanvas(bounds, combinesScale, coords, colors, figures,
backgroundColor) {
Function clipBbox
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
Avoid deeply nested control flow statements. Open
for (j = elemsInThisChunk; j--;) {
dest[destPos++] = src[srcPos++];
dest[destPos++] = src[srcPos++];
dest[destPos++] = src[srcPos++];
dest[destPos++] = 255;
Function InternalRenderTask
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function InternalRenderTask(callback, params, objs, commonObjs, operatorList,
pageNumber) {
Function TilingPattern
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function TilingPattern(IR, color, ctx, objs, commonObjs, baseTransform) {
Method send_file_with_correct_extension
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_file_with_correct_extension(path, filename, content_type)
begin
raise ArgumentError.new "path must not be nil" unless path
raise ArgumentError.new "path must exist" unless File.exists? path
e = File.extname(path)
- 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
redirect_to_primary_custom_url(custom_url) unless (self.class == MediaSetsController)
Avoid deeply nested control flow statements. Open
redirect_to_primary_custom_url(custom_url) unless (self.class == MediaEntriesController)
Method change_ownership
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def change_ownership
unless transfer_option_available?
redirect_to :back, flash: { notice: 'Choose at least one of transfer option.' } 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"
Further reading
Method show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show
if Concerns::CustomUrls::UUID_MATCHER.match params[:id]
@media_resource= MediaResource.find(params[:id])
unless @api_application.authorized?(:view,@media_resource)
raise ActiveRecord::RecordNotFound.new(@media_resource)
- 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
redirect_to_primary_custom_url(custom_url) unless (self.class == FilterSetsController)
Method check_and_initialize_for_view
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_and_initialize_for_view
# here, everything is initialized that we need everywhere (Tabs!)
@media_set = find_media_resource
raise UserUnauthorizedError unless current_user.login.present? || current_user.authorized?(:view, @media_set)
raise UserForbiddenError unless current_user.authorized?(:view,@media_set)
- 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 check_and_initialize_for_view
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_and_initialize_for_view
@media_entry = find_media_resource
raise "Wrong type" unless @media_entry.is_a? MediaEntry
raise UserUnauthorizedError if (logged_in? && current_user.login.nil?) && @media_entry.view == false
raise UserForbiddenError unless current_user.try(:authorized?, :view, @media_entry) || @media_entry.view == 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
Avoid deeply nested control flow statements. Open
case with[:children][:type]
when "media_entry"
media_resources = media_resources.media_entries
when "media_set"
media_resources = media_resources.media_sets
Avoid deeply nested control flow statements. Open
case with[:children][:type]
when "media_entry"
media_resources = media_resources.media_entries
when "media_set"
media_resources = media_resources.media_sets