Showing 377 of 529 total issues
Function DownloadManagerClosure
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
var DownloadManager = (function DownloadManagerClosure() {
function download(blobUrl, filename) {
var a = document.createElement('a');
if (a.click) {
Method initilize_resources_and_more
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initilize_resources_and_more
@action = params['_action'].to_sym
@all_media_resources= if params[:media_resource_id] # the case where we edit one
Method hash_for_media_resources_with_pagination
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def hash_for_media_resources_with_pagination(media_resources, pagination, with = nil, type_totals = false)
page = (pagination.is_a?(Hash) ? pagination[:page] : nil) || 1
per_page = [((pagination.is_a?(Hash) ? pagination[:per_page] : nil) || PER_PAGE.first).to_i.abs, PER_PAGE.last].min
paginated_media_resources = media_resources.page(page).per(per_page)
- 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 hash_for_meta_datum
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def hash_for_meta_datum(meta_datum, with = nil)
h = {
name: "#{meta_datum.meta_key.label}",
value: ((s = meta_datum.to_s).blank? ? nil : s),
raw_value: meta_datum.is_a?(MetaDatumString) ? meta_datum.value(current_user) : hash_for(meta_datum.value),
- 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 pdfViewError
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
error: function pdfViewError(message, moreInfo) {
var moreInfoText = mozL10n.get('error_version_info',
{version: PDFJS.version || '?', build: PDFJS.build || '?'},
'PDF.js v{{version}} (build: {{build}})') + '\n';
if (moreInfo) {
Function WorkerTransport
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WorkerTransport(workerInitializedCapability, workerReadyCapability,
pdfDataRangeTransport, progressCallback) {
this.pdfDataRangeTransport = pdfDataRangeTransport;
this.workerReadyCapability = workerReadyCapability;
Function pdfViewOpen
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
open: function pdfViewOpen(url, scale, password,
pdfDataRangeTransport, args) {
if (this.pdfDocument) {
// Reload the preferences if a document was previously opened.
Preferences.reload();
Function fontAdded
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
fontAdded: function fontAdded(fontObj, url) {
function properties(obj, list) {
var moreInfo = document.createElement('table');
for (var i = 0; i < list.length; i++) {
var tr = document.createElement('tr');
Function genericComposeSMask
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function genericComposeSMask(maskCtx, layerCtx, width, height,
subtype, backdrop) {
var addBackdropFn;
if (backdrop) {
addBackdropFn = function (r0, g0, b0, bytes) {
Function WidgetAnnotationClosure
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
var WidgetAnnotation = (function WidgetAnnotationClosure() {
function WidgetAnnotation(params) {
Annotation.call(this, params);
Function PageViewport
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
this.viewBox = viewBox;
this.scale = scale;
this.rotation = rotation;
this.offsetX = offsetX;
Method filter
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter(current_user, filter_opts)
filter_opts = filter_opts.delete_if {|k,v| v.blank?}.deep_symbolize_keys
raise "invalid option" unless filter_opts.is_a?(Hash)
############################################################
Method index
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
respond_to do |format|
format.json {
users = Person.hacky_search(params[:query]).map(&:user).compact
render :json => view_context.json_for(users)
Function pdfHistoryPush
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
push: function pdfHistoryPush(params, isInitialBookmark) {
if (!(this.initialized && this.historyUnlocked)) {
return;
}
if (params.dest && !params.hash) {
Function Annotation
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Annotation(params) {
if (params.data) {
this.data = params.data;
return;
}
Method login_from_session
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def login_from_session
user = nil
if session[:user_id]
Function loadLocale
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadLocale(lang, callback) {
callback = callback || function _callback() {};
clear();
gLanguage = lang;
Function createMeshCanvas
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createMeshCanvas(bounds, combinesScale, coords, colors, figures,
backgroundColor) {
// we will increase scale on some weird factor to let antialiasing take
// care of "rough" edges
var EXPECTED_SCALE = 1.1;
Method index
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
respond_to do |format|
format.json do
groups = Group.where('name ilike :query OR institutional_group_name ilike :query',
{:query => "%#{params[:query]}%"})
Function StepperManagerClosure
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
var StepperManager = (function StepperManagerClosure() {
var steppers = [];
var stepperDiv = null;
var stepperControls = null;
var stepperChooser = null;
- 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"