hack4impact/maps4all

View on GitHub

Showing 207 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

          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

                Function Case has 196 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                quail.lib.Case = (function () {
                
                  /**
                   * A Case is a test against an element.
                   */
                Severity: Major
                Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 7 hrs to fix

                  Function TestAggregator has 177 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  quail.lib.wcag2.TestAggregator = (function () {
                  
                    var pointerMap = {
                      elms: [],
                      pointers: [],
                  Severity: Major
                  Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 7 hrs to fix

                    Function search_resources has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def search_resources():
                        name = request.args.get('name')
                        if name is None:
                            name = ""
                        req_options = request.args.getlist('reqoption')
                    Severity: Minor
                    Found in app/main/views.py - About 6 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

                    Function SuccessCriteria has 167 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function validate_required_option_descriptor has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def validate_required_option_descriptor():
                          """ If there are resources that don't have the selected required option descriptor value set,
                          enforce that they are updated to have the required option descriptor """
                          csv_storage = CsvStorage.most_recent(user=current_user)
                          if csv_storage is None:
                      Severity: Minor
                      Found in app/bulk_resource/views.py - About 6 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

                      Function upload_row has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def upload_row():
                          """ Processes each Deferred Ajax request """
                          data = json.loads(request.form['json'])
                      
                          # Store CSV fields as descriptors
                      Severity: Minor
                      Found in app/bulk_resource/views.py - About 5 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

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

                      from flask import abort, flash, render_template, redirect, url_for, request
                      from flask.ext.login import login_required
                      from sqlalchemy.exc import IntegrityError
                      from wtforms.fields import SelectField
                      from flask_wtf.file import InputRequired
                      Severity: Minor
                      Found in app/descriptor/views.py - About 5 hrs to fix

                        Function linkHasAUniqueContext has 130 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        quail.linkHasAUniqueContext = function (quail, test, Case) {
                        
                          var blockStyle = [
                            'block',
                            'flex',
                        Severity: Major
                        Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 5 hrs to fix

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

                          import os
                          import datetime
                          from flask import (
                              abort,
                              flash,
                          Severity: Minor
                          Found in app/admin/views.py - About 4 hrs to fix

                            Function edit has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def edit(resource_id):
                                """Edit a resource."""
                                resource = Resource.query.get(resource_id)
                                if resource is None:
                                    abort(404)
                            Severity: Minor
                            Found in app/single_resource/views.py - 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

                            Function set_descriptor_types has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def set_descriptor_types():
                                """ Sets each descriptor in the CSV to be an option, text, or hyperlink descriptor """
                                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 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

                            Severity
                            Category
                            Status
                            Source
                            Language