Showing 121 of 349 total issues

Function showStatus has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  showStatus: function(response) {
    var url, content;
    if (response.content === undefined) {
      content = response.data;
      url = response.url;
Severity: Major
Found in swagger-ui/js/view/OperationView.js - About 3 hrs to fix

    File current_murs.py has 316 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import logging
    import re
    from collections import defaultdict
    from urllib.parse import urlencode
    
    
    Severity: Minor
    Found in webservices/legal_docs/current_murs.py - About 3 hrs to fix

      Function initialize has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

        initialize: function(opts){
          var sorterOption, sorterFn, key, value;
          opts = opts || {};
      
          this.router = opts.router;
      Severity: Minor
      Found in swagger-ui/js/view/MainView.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

      File manage.py has 315 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      
      import os
      import glob
      import logging
      Severity: Minor
      Found in manage.py - About 3 hrs to fix

        File aggregates.py has 300 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import sqlalchemy as sa
        
        from flask_apispec import doc
        
        from webservices import args
        Severity: Minor
        Found in webservices/resources/aggregates.py - About 3 hrs to fix

          Function get_title_52_statutes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_title_52_statutes():
              es = utils.get_elasticsearch_connection()
          
              title_parsed = get_xml_tree_from_url('http://uscode.house.gov/download/' +
                              'releasepoints/us/pl/114/219/xml_usc52@114-219.zip')
          Severity: Minor
          Found in webservices/legal_docs/load_legal_docs.py - About 2 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 get_title_26_statutes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_title_26_statutes():
              es = utils.get_elasticsearch_connection()
          
              title_parsed = get_xml_tree_from_url('http://uscode.house.gov/download/' +
                              'releasepoints/us/pl/114/219/xml_usc26@114-219.zip')
          Severity: Minor
          Found in webservices/legal_docs/load_legal_docs.py - About 2 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 get_subject_tree has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_subject_tree(html, tree=None):
              """This is a standard shift-reduce parser for extracting the tree of subject
              topics from the html. Using a html parser (eg., beautifulsoup4) would not have
              solved this problem, since the parse tree we want is _not_ represented in
              the hierarchy of html elements. Depending on the tag, the algorithm either shifts
          Severity: Minor
          Found in webservices/legal_docs/load_legal_docs.py - About 2 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 formatXml has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            formatXml: function(xml) {
              var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
              reg = /(>)(<)(\/*)/g;
              wsexp = /[ ]*(.*)[ ]+\n/g;
              contexp = /(<.+>)(.+\n)/g;
          Severity: Major
          Found in swagger-ui/js/view/OperationView.js - About 2 hrs to fix

            Function get_ao_citations has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_ao_citations():
                logger.info("getting citations...")
                ao_names_results = db.engine.execute("""SELECT ao_no, name FROM aouser.document
                                              INNER JOIN aouser.ao ON ao.ao_id = document.ao_id""")
                ao_names = {}
            Severity: Minor
            Found in webservices/legal_docs/load_legal_docs.py - About 2 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 marked has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function marked(src, opt, callback) {
              if (callback || typeof opt === 'function') {
                if (!callback) {
                  callback = opt;
                  opt = null;
            Severity: Major
            Found in static/swagger-ui/vendor/marked.js - About 2 hrs to fix

              Function handleFileUpload has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                handleFileUpload: function(map, form) {
                  var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, p, param, params, ref1, ref2, ref3, ref4;
                  ref1 = form.serializeArray();
                  for (l = 0, len = ref1.length; l < len; l++) {
                    o = ref1[l];
              Severity: Major
              Found in swagger-ui/js/view/OperationView.js - About 2 hrs to fix

                File elections.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import sqlalchemy as sa
                from sqlalchemy import cast, Integer
                from flask_apispec import doc, marshal_with
                
                from webservices import args
                Severity: Minor
                Found in webservices/resources/elections.py - About 2 hrs to fix

                  Function handleFileUpload has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                    handleFileUpload: function(map, form) {
                      var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, p, param, params, ref1, ref2, ref3, ref4;
                      ref1 = form.serializeArray();
                      for (l = 0, len = ref1.length; l < len; l++) {
                        o = ref1[l];
                  Severity: Minor
                  Found in swagger-ui/js/view/OperationView.js - About 2 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 render has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render: function() {
                      var type = this.model.type || this.model.dataType;
                  
                      if (typeof type === 'undefined') {
                        var schema = this.model.schema;
                  Severity: Minor
                  Found in swagger-ui/js/view/ParameterView.js - About 2 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 reports.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import sqlalchemy as sa
                  from flask_apispec import doc, marshal_with
                  
                  from webservices import args
                  from webservices import docs
                  Severity: Minor
                  Found in webservices/resources/reports.py - About 2 hrs to fix

                    Function parse_option has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def parse_option(option, model=None, aliases=None, join_columns=None, query=None):
                        """Parse sort option to SQLAlchemy order expression.
                    
                        :param str option: Column name, possibly prefixed with "-"
                        :param model: Optional SQLAlchemy model to sort on
                    Severity: Minor
                    Found in webservices/sorting.py - About 2 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 legal.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import re
                    
                    from elasticsearch_dsl import Search, Q
                    from webargs import fields
                    from flask import abort
                    Severity: Minor
                    Found in webservices/resources/legal.py - About 2 hrs to fix

                      Function execute_query has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def execute_query(query):
                          es_results = query.execute()
                          formatted_hits = []
                          for hit in es_results:
                              formatted_hit = hit.to_dict()
                      Severity: Minor
                      Found in webservices/resources/legal.py - About 2 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 render has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render: function() {
                          var type = this.model.type || this.model.dataType;
                      
                          if (typeof type === 'undefined') {
                            var schema = this.model.schema;
                      Severity: Major
                      Found in swagger-ui/js/view/ParameterView.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language