Showing 377 of 529 total issues
Consider simplifying this complex logical expression. Open
elsif request.format.to_sym == :json or
(request[:controller] == "media_resources" and request[:action] == "image") or
(request[:controller] == "media_resources" and request[:action] == "show") or
(request[:controller] == "media_resources" and request[:action] == "index") or
(request[:controller] == "media_resources" and request[:action] == "browse") or
Function StepperClosure
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
var Stepper = (function StepperClosure() {
// Shorter way to create element and optionally set textContent.
function c(tag, textContent) {
var d = document.createElement(tag);
if (textContent) {
- 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 AnnotationClosure
has 269 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Annotation = (function AnnotationClosure() {
// 12.5.5: Algorithm: Appearance streams
function getTransformMatrix(rect, bbox, matrix) {
var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
var minX = bounds[0];
Function PromiseClosure
has 248 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function PromiseClosure() {
if (globalScope.Promise) {
// Promises existing in the DOM/Worker, checking presence of all/resolve
if (typeof globalScope.Promise.all !== 'function') {
globalScope.Promise.all = function (iterable) {
Function textLayerBuilder
has 243 lines of code (exceeds 25 allowed). Consider refactoring. Open
var TextLayerBuilder = function textLayerBuilder(options) {
var textLayerFrag = document.createDocumentFragment();
this.textLayerDiv = options.textLayerDiv;
this.layoutDone = false;
File debugger.js
has 552 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
Method login_from_session
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
def login_from_session
user = nil
if session[:user_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 the_messy_before_filter
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def the_messy_before_filter
if [:edit_multiple, :update_multiple, :remove_multiple].include? request[:action].to_sym
begin
if !params[:media_set_id].blank?
action = case request[:action].to_sym
- 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 pdfViewLoad
has 194 lines of code (exceeds 25 allowed). Consider refactoring. Open
load: function pdfViewLoad(pdfDocument, scale) {
var self = this;
var isOnePageRenderedResolved = false;
var resolveOnePageRendered = null;
var onePageRendered = new Promise(function (resolve) {
Method process_metadata
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def process_metadata meta_arr
meta_arr.each do |tag_array_entry|
tag_array_entry.each do |entry_key, entry_value|
if entry_key =~ /^XMP-(expressionmedia|mediapro):UserFields/
- 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 keydown
has 189 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.addEventListener('keydown', function keydown(evt) {
if (OverlayManager.active) {
return;
}
Function WorkerTransport_setupMessageHandler
has 186 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WorkerTransport_setupMessageHandler(messageHandler) {
this.messageHandler = messageHandler;
function updatePassword(password) {
messageHandler.send('UpdatePassword', password);
Method to_tms
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def to_tms(xml, io_interface)
xml.snapshot do
#old# meta_data.each do |meta_datum|
meta_data.for_io_interface(io_interface).each do |meta_datum|
key_map = meta_datum.meta_key.key_map_for(io_interface)
- 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 StepperClosure
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Stepper = (function StepperClosure() {
// Shorter way to create element and optionally set textContent.
function c(tag, textContent) {
var d = document.createElement(tag);
if (textContent) {
Method hash_for_filter
has 171 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hash_for_filter(media_resources, filter_types = [:media_files, :permissions, :meta_data, :media_resource_type])
r = []
if filter_types.include? :media_resource_type
r << { :filter_type => "media_resources",
Function PDFPageProxyClosure
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PDFPageProxy = (function PDFPageProxyClosure() {
function PDFPageProxy(pageIndex, pageInfo, transport) {
this.pageIndex = pageIndex;
this.pageInfo = pageInfo;
this.transport = transport;
Function webViewerInitialized
has 155 lines of code (exceeds 25 allowed). Consider refactoring. Open
function webViewerInitialized() {
var params = PDFView.parseQueryString(document.location.search.substring(1));
var file = 'file' in params ? params.file : DEFAULT_URL;
var fileInput = document.createElement('input');
PDFView
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
var PDFView = {
pages: [],
thumbnails: [],
currentScale: UNKNOWN_SCALE,
currentScaleValue: null,
Function thumbnailView
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ThumbnailView = function thumbnailView(container, id, defaultViewport) {
var anchor = document.createElement('a');
anchor.href = PDFView.getAnchorUrl('#page=' + id);
anchor.title = mozL10n.get('thumb_page_title', {page: id}, 'Page {{page}}');
anchor.onclick = function stopNavigation() {
Function UtilClosure
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Util = PDFJS.Util = (function UtilClosure() {
function Util() {}
Util.makeCssRgb = function Util_makeCssRgb(rgb) {
return 'rgb(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + ')';