hack4impact/maps4all

View on GitHub

Showing 457 of 457 total issues

File quail.jquery.js has 7894 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! QUAIL quailjs.org | quailjs.org/license */
;(function($) {
'use strict';
// Polyfill Function.prototype.bind
// @see https://gist.github.com/dsingleton/1312328
Severity: Major
Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 3 wks to fix

    Function save_csv has a Cognitive Complexity of 173 (exceeds 5 allowed). Consider refactoring.
    Open

    def save_csv():
        """ Last step in CSV workflow to update the resource and descriptor data models. """
        csv_storage = CsvStorage.most_recent(user=current_user)
        if csv_storage is None:
            db.session.rollback()
    Severity: Minor
    Found in app/bulk_resource/views.py - About 3 days 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

    Function color has 365 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    quail.components.color = (function () {
    
      function buildCase(test, Case, element, status, id, message) {
        test.add(Case({
          element: element,
    Severity: Major
    Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 1 day to fix

      File views.py has 655 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from datetime import datetime
      import json
      import geocoder
      import time
      import os
      Severity: Major
      Found in app/bulk_resource/views.py - About 1 day to fix

        Function Test has 288 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        quail.lib.Test = (function () {
        
          /**
           * A collection of Cases.
           */
        Severity: Major
        Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 1 day to fix

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

          (function(){CKEDITOR.plugins.a11ychecker.quickFixes.get({langCode:"de",name:"QuickFix",callback:function(b){function a(a){b.call(this,a)}a.prototype=new b;a.prototype.constructor=a;a.prototype.display=function(a){a.setInputs({})};a.prototype.fix=function(a,b){this.issue.element.remove();b&&b(this)};a.prototype.lang={};CKEDITOR.plugins.a11ychecker.quickFixes.add("de/ElementRemove",a)}})})();
          app/static/ckeditor/plugins/a11ychecker/quickfix/en/ElementRemove.js on lines 5..5
          app/static/ckeditor/plugins/a11ychecker/quickfix/nl/ElementRemove.js on lines 5..5

          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 232.

          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 3 locations. Consider refactoring.
          Open

          (function(){CKEDITOR.plugins.a11ychecker.quickFixes.get({langCode:"en",name:"QuickFix",callback:function(b){function a(a){b.call(this,a)}a.prototype=new b;a.prototype.constructor=a;a.prototype.display=function(a){a.setInputs({})};a.prototype.fix=function(a,b){this.issue.element.remove();b&&b(this)};a.prototype.lang={};CKEDITOR.plugins.a11ychecker.quickFixes.add("en/ElementRemove",a)}})})();
          app/static/ckeditor/plugins/a11ychecker/quickfix/de/ElementRemove.js on lines 5..5
          app/static/ckeditor/plugins/a11ychecker/quickfix/nl/ElementRemove.js on lines 5..5

          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 232.

          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 3 locations. Consider refactoring.
          Open

          (function(){CKEDITOR.plugins.a11ychecker.quickFixes.get({langCode:"nl",name:"QuickFix",callback:function(b){function a(a){b.call(this,a)}a.prototype=new b;a.prototype.constructor=a;a.prototype.display=function(a){a.setInputs({})};a.prototype.fix=function(a,b){this.issue.element.remove();b&&b(this)};a.prototype.lang={};CKEDITOR.plugins.a11ychecker.quickFixes.add("nl/ElementRemove",a)}})})();
          app/static/ckeditor/plugins/a11ychecker/quickfix/de/ElementRemove.js on lines 5..5
          app/static/ckeditor/plugins/a11ychecker/quickfix/en/ElementRemove.js on lines 5..5

          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 232.

          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

          File map.js has 560 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // This JS file is for the map and list view creations on the homepage of the
          // Maps4All site for the user. This example requires the Places library. Include
          // the libraries=places parameter when you first load the API. For example:
          // <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">
          
          
          Severity: Major
          Found in app/assets/scripts/map.js - About 1 day to fix

            Function set_required_option_descriptor has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
            Open

            def set_required_option_descriptor():
                """ Choose one option descriptor to be the required option descriptor.
                Can only select from option descriptors in the CSV or the existing required
                option descriptor if any. """
                csv_storage = CsvStorage.most_recent(user=current_user)
            Severity: Minor
            Found in app/bulk_resource/views.py - About 1 day 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

            Function htmlTagValidator has 222 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var htmlTagValidator=function(){
              var startingTagFirstChar="<",
                startingTagLastChar=">",
                closingTagSecondChar="/",
                selfClosingTagSecondToLastChar="/",
            Severity: Major
            Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 1 day to fix

              Function TestCollection has 206 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              quail.lib.TestCollection = (function () {
              
                /**
                 * A Collection of Tests.
                 */
              Severity: Major
              Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 1 day to fix

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

                @admin.route('/customize-site/style', methods=['GET', 'POST'])
                @login_required
                @admin_required
                def change_site_style():
                    """Change a site's stylesheet."""
                Severity: Major
                Found in app/admin/views.py and 1 other location - About 1 day to fix
                app/admin/views.py on lines 325..344

                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 122.

                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

                @admin.route('/customize-site/logo', methods=['GET', 'POST'])
                @login_required
                @admin_required
                def change_site_logo():
                    """Change a site's logo."""
                Severity: Major
                Found in app/admin/views.py and 1 other location - About 1 day to fix
                app/admin/views.py on lines 347..366

                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 122.

                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 6 locations. Consider refactoring.
                Open

                  test.get('$scope').each(function () {
                    var textNodes = document.evaluate('descendant::text()[normalize-space()]', this, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
                    var nodes = [];
                    var textNode = textNodes.iterateNext();
                
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3482..3504
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3551..3572
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3699..3720
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3753..3775
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3799..3820

                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 193.

                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 6 locations. Consider refactoring.
                Open

                  test.get('$scope').each(function () {
                    var textNodes = document.evaluate('descendant::text()[normalize-space()]', this, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
                    var nodes = [];
                    var textNode = textNodes.iterateNext();
                
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3482..3504
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3627..3648
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3699..3720
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3753..3775
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3799..3820

                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 193.

                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 6 locations. Consider refactoring.
                Open

                  test.get('$scope').each(function () {
                    var textNodes = document.evaluate('descendant::text()[normalize-space()]', this, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
                    var nodes = [];
                    var textNode = textNodes.iterateNext();
                
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3482..3504
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3551..3572
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3627..3648
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3699..3720
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3799..3820

                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 193.

                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 6 locations. Consider refactoring.
                Open

                  test.get('$scope').each(function () {
                    var textNodes = document.evaluate('descendant::text()[normalize-space()]', this, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
                    var nodes = [];
                    var textNode = textNodes.iterateNext();
                
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3482..3504
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3551..3572
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3627..3648
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3753..3775
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3799..3820

                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 193.

                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 6 locations. Consider refactoring.
                Open

                  test.get('$scope').each(function () {
                    var textNodes = document.evaluate('descendant::text()[normalize-space()]', this, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
                    var nodes = [];
                    var textNode = textNodes.iterateNext();
                
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3482..3504
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3551..3572
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3627..3648
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3699..3720
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3753..3775

                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 193.

                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 6 locations. Consider refactoring.
                Open

                  test.get('$scope').each(function () {
                    var textNodes = document.evaluate('descendant::text()[normalize-space()]', this, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
                    var nodes     = [];
                    var textNode  = textNodes.iterateNext();
                
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3551..3572
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3627..3648
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3699..3720
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3753..3775
                app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js on lines 3799..3820

                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 193.

                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