Showing 529 of 529 total issues

Function vocabulary has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.App.vocabulary = function (config) {
  
  // This includes support for filterbar and slider on 
  // all 'vocabulary' pages (contexts and set/contexts).
  
Severity: Major
Found in app/assets/javascripts/vocabulary.js - About 4 hrs to fix

    Function setupAnnotations has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function setupAnnotations(pageDiv, pdfPage, viewport) {
    
        function bindLink(link, dest) {
          link.href = PDFView.getDestinationHash(dest);
          link.onclick = function pageViewSetupLinksOnclick() {
    Severity: Major
    Found in public/mozilla-pdf/web/viewer.js - About 4 hrs to fix

      Function drawFigures has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function drawFigures(width, height, backgroundColor, figures, context) {
          if (!figuresCache) {
            initFiguresGL();
          }
          var cache = figuresCache, canvas = cache.canvas, gl = cache.gl;
      Severity: Major
      Found in public/mozilla-pdf/core/pdf.js - About 4 hrs to fix

        Function TilingPatternClosure has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var TilingPattern = (function TilingPatternClosure() {
          var PaintType = {
            COLORED: 1,
            UNCOLORED: 2
          };
        Severity: Major
        Found in public/mozilla-pdf/core/pdf.js - About 4 hrs to fix

          Method included has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.included(base)
                base.class_eval do 
          
                  # to build joins over to meta_terms from a media resource
                  has_many :meta_data_meta_terms, 
          Severity: Major
          Found in app/models/media_resource_modules/meta_data.rb - About 4 hrs to fix

            Function pdfHistoryPush has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

              push: function pdfHistoryPush(params, isInitialBookmark) {
                if (!(this.initialized && this.historyUnlocked)) {
                  return;
                }
                if (params.dest && !params.hash) {
            Severity: Minor
            Found in public/mozilla-pdf/web/viewer.js - About 4 hrs to fix

            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 has a Cognitive Complexity of 29 (exceeds 5 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) 
            
                    ############################################################
            Severity: Minor
            Found in app/models/media_resource_modules/filter.rb - About 4 hrs to fix

            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_media_resource has 106 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def hash_for_media_resource(media_resource, with = nil)
                  h = {
                    id: media_resource.id,
                    created_at: media_resource.created_at.iso8601,
                    updated_at: media_resource.updated_at.iso8601,
            Severity: Major
            Found in app/helpers/json/media_resource_helper.rb - About 4 hrs to fix

              Function mozPrintCallbackPolyfillClosure has 104 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              (function mozPrintCallbackPolyfillClosure() {
                if ('mozPrintCallback' in document.createElement('canvas')) {
                  return;
                }
                // Cause positive result on feature-detection:
              Severity: Major
              Found in public/mozilla-pdf/web/viewer.js - About 4 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      } else {
                        k = y > y3 ? 1 : y2 === y3 ? 0 : (y2 - y) / (y2 - y3);
                        xa = x2 - (x2 - x3) * k;
                        car = c2r - (c2r - c3r) * k;
                        cag = c2g - (c2g - c3g) * k;
                Severity: Major
                Found in public/mozilla-pdf/core/pdf.js and 1 other location - About 4 hrs to fix
                public/mozilla-pdf/core/pdf.js on lines 6286..6292

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 118.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      if (y < y2) {
                        k = y < y1 ? 0 : y1 === y2 ? 1 : (y1 - y) / (y1 - y2);
                        xa = x1 - (x1 - x2) * k;
                        car = c1r - (c1r - c2r) * k;
                        cag = c1g - (c1g - c2g) * k;
                Severity: Major
                Found in public/mozilla-pdf/core/pdf.js and 1 other location - About 4 hrs to fix
                public/mozilla-pdf/core/pdf.js on lines 6292..6298

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 118.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function CanvasGraphics_showText has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    showText: function CanvasGraphics_showText(glyphs) {
                      var current = this.current;
                      var font = current.font;
                      if (font.isType3Font) {
                        return this.showType3Text(glyphs);
                Severity: Major
                Found in public/mozilla-pdf/core/pdf.js - About 4 hrs to fix

                  File media_resource_helper.rb has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Json
                    module MediaResourceHelper
                  
                      def hash_for_media_resource(media_resource, with = nil)
                        h = {
                  Severity: Minor
                  Found in app/helpers/json/media_resource_helper.rb - About 4 hrs to fix

                    Function PDFBugClosure has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var PDFBug = (function PDFBugClosure() {
                      var panelWidth = 300;
                      var buttons = [];
                      var activePanel = null;
                    
                    
                    Severity: Major
                    Found in public/mozilla-pdf/web/debugger.js - About 3 hrs to fix

                      Function TextAnnotation_getHtmlElement has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          getHtmlElement: function TextAnnotation_getHtmlElement(commonObjs) {
                            assert(!isWorker, 'getHtmlElement() shall be called from main thread');
                      
                            var item = this.data;
                            var rect = item.rect;
                      Severity: Major
                      Found in public/mozilla-pdf/core/pdf.js - About 3 hrs to fix

                        Function pdfViewLoad has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                        Open

                          load: function pdfViewLoad(pdfDocument, scale) {
                            var self = this;
                            var isOnePageRenderedResolved = false;
                            var resolveOnePageRendered = null;
                            var onePageRendered = new Promise(function (resolve) {
                        Severity: Minor
                        Found in public/mozilla-pdf/web/viewer.js - About 3 hrs to fix

                        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 redirect_to_primary_url has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def redirect_to_primary_url
                              if UUID_MATCHER.match params[:id] # id is a UUID; redirect if there is a custom primary url
                                if (@media_resource=MediaResource.find(params[:id])) and (primary_custom_url= @media_resource.primary_custom_url)
                                  redirect_to_primary_custom_url(primary_custom_url)
                                end
                        Severity: Minor
                        Found in app/controllers/concerns/custom_urls.rb - About 3 hrs to fix

                        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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                              case 'outline':
                                thumbsButton.classList.remove('toggled');
                                outlineButton.classList.add('toggled');
                                attachmentsButton.classList.remove('toggled');
                                thumbsView.classList.add('hidden');
                        Severity: Major
                        Found in public/mozilla-pdf/web/viewer.js and 1 other location - About 3 hrs to fix
                        public/mozilla-pdf/web/viewer.js on lines 3787..3798

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 111.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          zoomOut: function pdfViewZoomOut(ticks) {
                            var newScale = this.currentScale;
                            do {
                              newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);
                              newScale = Math.floor(newScale * 10) / 10;
                        Severity: Major
                        Found in public/mozilla-pdf/web/viewer.js and 1 other location - About 3 hrs to fix
                        public/mozilla-pdf/web/viewer.js on lines 2866..2874

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 111.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          zoomIn: function pdfViewZoomIn(ticks) {
                            var newScale = this.currentScale;
                            do {
                              newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);
                              newScale = Math.ceil(newScale * 10) / 10;
                        Severity: Major
                        Found in public/mozilla-pdf/web/viewer.js and 1 other location - About 3 hrs to fix
                        public/mozilla-pdf/web/viewer.js on lines 2876..2884

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 111.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language