Showing 377 of 529 total issues
Method create
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def create
attr = params[:media_sets] || params[:media_set]
filter = params[:filter]
is_saved = 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
Function pdfHistoryInitialize
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function pdfHistoryInitialize(fingerprint) {
if (PDFJS.disableHistory || PDFView.isViewerEmbedded) {
// The browsing history is only enabled when the viewer is standalone,
// i.e. not when it is embedded in a web page.
return;
Function StepperManagerClosure
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
var StepperManager = (function StepperManagerClosure() {
var steppers = [];
var stepperDiv = null;
var stepperControls = null;
var stepperChooser = null;
Function pageViewScrollIntoView
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.scrollIntoView = function pageViewScrollIntoView(dest) {
if (PresentationMode.active) {
if (PDFView.page !== this.id) {
// Avoid breaking PDFView.getVisiblePages in presentation mode.
PDFView.page = this.id;
Function PageViewportClosure
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() {
/**
* @constructor
* @private
* @param viewBox {Array} xMin, yMin, xMax and yMax coordinates.
Function fontLoaderPrepareFontLoadEvent
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepareFontLoadEvent: function fontLoaderPrepareFontLoadEvent(rules,
fonts,
request) {
/** Hack begin */
// There's currently no event when a font has finished downloading so the
Function webViewerInitialized
has a Cognitive Complexity of 21 (exceeds 5 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');
- 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 CanvasGraphics_beginGroup
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
beginGroup: function CanvasGraphics_beginGroup(group) {
this.save();
var currentCtx = this.ctx;
// TODO non-isolated groups - according to Rik at adobe non-isolated
// group results aren't usually that different and they even have tools
Function updateOperatorList
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateOperatorList: function updateOperatorList(operatorList) {
var self = this;
function cboxOnClick() {
var x = +this.dataset.idx;
Function PDFPageProxy_render
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function PDFPageProxy_render(params) {
var stats = this.stats;
stats.time('Overall');
// If there was a pending destroy cancel it so no cleanup happens during
Function LinkAnnotationClosure
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
var LinkAnnotation = (function LinkAnnotationClosure() {
function LinkAnnotation(params) {
InteractiveAnnotation.call(this, params);
if (params.data) {
Function ViewHistoryClosure
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ViewHistory = (function ViewHistoryClosure() {
function ViewHistory(fingerprint) {
this.fingerprint = fingerprint;
this.isInitializedPromiseResolved = false;
this.initializedPromise =
Function MetadataClosure
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Metadata = PDFJS.Metadata = (function MetadataClosure() {
function fixMetadata(meta) {
return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g,
function(code, d1, d2, d3) {
Method index
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def index
@keyword_terms = KeywordTerm \
.with_count \
.with_users_count \
.with_date_of_creation \
- 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 CanvasGraphics_setGState
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
setGState: function CanvasGraphics_setGState(states) {
for (var i = 0, ii = states.length; i < ii; i++) {
var state = states[i];
var key = state[0];
var value = state[1];
Function updateViewarea
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateViewarea() {
if (!PDFView.initialized) {
return;
}
Method the_messy_before_filter
has 62 lines of code (exceeds 25 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
Function TextWidgetAnnotationClosure
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
function TextWidgetAnnotation(params) {
WidgetAnnotation.call(this, params);
if (params.data) {
Function pdfViewGetDestinationHash
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
getDestinationHash: function pdfViewGetDestinationHash(dest) {
if (typeof dest === 'string') {
return PDFView.getAnchorUrl('#' + escape(dest));
}
if (dest instanceof Array) {
- 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 filter_meta_data
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def filter_meta_data(resources, filter)
filter.each_pair do |k,v|
# this is AND implementation
v[:ids].each do |id|
# OPTIMIZE resource.joins(etc...) directly intersecting multiple criteria doesn't work, then we use subqueries
- 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"