hack4impact/maps4all

View on GitHub

Showing 207 of 457 total issues

Avoid deeply nested control flow statements.
Open

                    if cached is None:
                        db.session.rollback()
                        abort(404)
                    resource.latitude = cached.latitude
Severity: Major
Found in app/bulk_resource/views.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        for value in assocValues:
                            arguments = {
                                'resource_id': resource.id,
                                'descriptor_id': descriptor.id,
                                keyword: value,
    Severity: Major
    Found in app/bulk_resource/views.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if descriptor.dtype == 'text':
                              association_class = TextAssociation
                              keyword = 'text'
                              # see if same descriptor already exists
                              if csv_storage.action == 'update':
      Severity: Major
      Found in app/bulk_resource/views.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if type(value) == list:
                                value = csv_friendly('; '.join(value))
                            else:
                                value = csv_friendly(value)
                        values.append(value)
        Severity: Major
        Found in app/single_resource/views.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if desc.descriptor.values[desc.option] in option_map[opt]:
                                  number_of_options_found += 1
                                  break
                  if number_of_options_found == len(list(option_map.keys())):
          Severity: Major
          Found in app/main/views.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if desc.values:
                                        values = desc.values
                                    val = val.split(';')
            Severity: Major
            Found in app/models/csv.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for v in val:
                                          if v.strip():
                                              values.add(v.strip())
                                      desc.values = values
              Severity: Major
              Found in app/models/csv.py - About 45 mins to fix

                Function create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def create(sugg_id):
                    suggestion = Suggestion.query.get(sugg_id)
                    if suggestion is None:
                        abort(404)
                    descriptors = Descriptor.query.all()
                Severity: Minor
                Found in app/suggestion/views.py - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                    if descriptor is not None and descriptor.name == form.required_option_descriptor.data:
                                        req_opt_desc_const = RequiredOptionDescriptorConstructor(
                                            name=descriptor.name,
                                            values=descriptor.values
                                        )
                Severity: Major
                Found in app/bulk_resource/views.py - About 45 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (deltaY === -1 && isRowHeader(tableMap, currCell, x, y) ||
                          deltaX === -1 && isColumnHeader(tableMap, currCell, x, y)) {
                            blocked = true;
                  
                          } else {
                  Severity: Major
                  Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 40 mins to fix

                    Function colorBackgroundImageContrast has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      function colorBackgroundImageContrast(test, Case, options, $this, element) {
                    Severity: Minor
                    Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 35 mins to fix

                      Function colorBackgroundGradientContrast has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        function colorBackgroundGradientContrast(test, Case, options, $this, element) {
                      Severity: Minor
                      Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 35 mins to fix

                        Function scanHeaders has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          function scanHeaders(tableMap, x, y, deltaX, deltaY) {
                        Severity: Minor
                        Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 35 mins to fix

                          Function colorElementBehindBackgroundImageContrast has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            function colorElementBehindBackgroundImageContrast(test, Case, options, $this, element) {
                          Severity: Minor
                          Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 35 mins to fix

                            Function colorFontContrast has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              function colorFontContrast(test, Case, options, $this, element) {
                            Severity: Minor
                            Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 35 mins to fix

                              Function colorElementBehindBackgroundGradientContrast has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                function colorElementBehindBackgroundGradientContrast(test, Case, options, $this, element) {
                              Severity: Minor
                              Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 35 mins to fix

                                Function colorElementBehindContrast has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  function colorElementBehindContrast(test, Case, options, $this, element) {
                                Severity: Minor
                                Found in app/static/ckeditor/plugins/a11ychecker/libs/quail/quail.jquery.js - About 35 mins to fix

                                  Function change_option_values_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def change_option_values_index(desc_id):
                                      """Shows the page to add/edit/remove a descriptor's option values."""
                                      descriptor = Descriptor.query.get(desc_id)
                                      if descriptor is None:
                                          abort(404)
                                  Severity: Minor
                                  Found in app/descriptor/views.py - About 35 mins 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 reset_password has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def reset_password(token):
                                      """Reset an existing user's password."""
                                      if not current_user.is_anonymous():
                                          return redirect(url_for('main.index'))
                                      form = ResetPasswordForm()
                                  Severity: Minor
                                  Found in app/account/views.py - About 35 mins 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 get_associations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  def get_associations(resource_id):
                                      resource = Resource.query.get(resource_id)
                                      associations = {} # map from descriptor name -> {descriptor value(s), descriptor type}
                                      if resource is None:
                                          return json.dumps(associations)
                                  Severity: Minor
                                  Found in app/main/views.py - About 35 mins 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