Showing 121 of 349 total issues

File docs.py has 1091 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Narrative API documentation."""

BEGINNING_IMAGE_NUMBER = '''
Unique identifier for the electronic or paper report. This number is used to construct
PDF URLs to the original document.
Severity: Major
Found in webservices/docs.py - About 2 days to fix

    File schemas.py has 944 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import re
    import functools
    import json
    
    from collections import namedtuple
    Severity: Major
    Found in webservices/schemas.py - About 2 days to fix

      File marked.js has 901 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * marked - a markdown parser
       * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
       * https://github.com/chjj/marked
       */
      Severity: Major
      Found in static/swagger-ui/vendor/marked.js - About 2 days to fix

        Function render has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
        Open

          render: function() {
            var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value;
            isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
            if (!isMethodSubmissionSupported) {
              this.model.isReadOnly = true;
        Severity: Minor
        Found in swagger-ui/js/view/OperationView.js - About 2 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

        File args.py has 658 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import functools
        
        from marshmallow.compat import text_type
        
        import sqlalchemy as sa
        Severity: Major
        Found in webservices/args.py - About 1 day to fix

          File OperationView.js has 648 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          SwaggerUi.Views.OperationView = Backbone.View.extend({
            invocationUrl: null,
          
          
          Severity: Major
          Found in swagger-ui/js/view/OperationView.js - About 1 day to fix

            File itemized.py has 647 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import marshmallow as ma
            import sqlalchemy as sa
            
            from sqlalchemy.ext.hybrid import hybrid_property
            from sqlalchemy.dialects.postgresql import TSVECTOR
            Severity: Major
            Found in webservices/common/models/itemized.py - About 1 day to fix

              Function token has 213 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Lexer.prototype.token = function(src, top, bq) {
                var src = src.replace(/^ +$/gm, '')
                  , next
                  , loose
                  , cap
              Severity: Major
              Found in static/swagger-ui/vendor/marked.js - About 1 day to fix

                File reports.py has 506 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from webservices import docs, utils
                
                from .base import db, BaseModel
                
                from sqlalchemy.ext.hybrid import hybrid_property
                Severity: Major
                Found in webservices/common/models/reports.py - About 1 day to fix

                  File index_management.py has 466 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import logging
                  
                  import elasticsearch
                  
                  from webservices import utils
                  Severity: Minor
                  Found in webservices/legal_docs/index_management.py - About 7 hrs to fix

                    Function render has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render: function() {
                        var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value;
                        isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
                        if (!isMethodSubmissionSupported) {
                          this.model.isReadOnly = true;
                    Severity: Major
                    Found in swagger-ui/js/view/OperationView.js - About 6 hrs to fix

                      Function showStatus has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                      Open

                        showStatus: function(response) {
                          var url, content;
                          if (response.content === undefined) {
                            content = response.data;
                            url = response.url;
                      Severity: Minor
                      Found in swagger-ui/js/view/OperationView.js - 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 load_legal_docs.py has 391 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      #!/usr/bin/env python
                      
                      import itertools
                      import re
                      from zipfile import ZipFile
                      Severity: Minor
                      Found in webservices/legal_docs/load_legal_docs.py - About 5 hrs to fix

                        File rest.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        """
                        A RESTful web service supporting fulltext and field-specific searches on FEC data. For
                        full documentation visit: https://api.open.fec.gov/developers.
                        """
                        from webservices.env import env
                        Severity: Minor
                        Found in webservices/rest.py - About 4 hrs to fix

                          Function output has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          InlineLexer.prototype.output = function(src) {
                            var out = ''
                              , link
                              , text
                              , href
                          Severity: Major
                          Found in static/swagger-ui/vendor/marked.js - About 4 hrs to fix

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

                              submitOperation: function(e) {
                                var error_free, form, isFileUpload, l, len, len1, len2, m, map, n, o, opts, ref1, ref2, ref3, val;
                                if (e !== null) {
                                  e.preventDefault();
                                }
                            Severity: Minor
                            Found in swagger-ui/js/view/OperationView.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

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

                            def apply_ao_specific_query_params(query, **kwargs):
                                must_clauses = []
                                if kwargs.get('ao_no'):
                                    must_clauses.append(Q('terms', no=kwargs.get('ao_no')))
                            
                            
                            Severity: Minor
                            Found in webservices/resources/legal.py - 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 utils.py has 327 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import re
                            import functools
                            import json
                            import logging
                            
                            
                            Severity: Minor
                            Found in webservices/utils.py - About 3 hrs to fix

                              Function submitOperation has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                submitOperation: function(e) {
                                  var error_free, form, isFileUpload, l, len, len1, len2, m, map, n, o, opts, ref1, ref2, ref3, val;
                                  if (e !== null) {
                                    e.preventDefault();
                                  }
                              Severity: Major
                              Found in swagger-ui/js/view/OperationView.js - About 3 hrs to fix

                                Function tok has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                Parser.prototype.tok = function() {
                                  switch (this.token.type) {
                                    case 'space': {
                                      return '';
                                    }
                                Severity: Major
                                Found in static/swagger-ui/vendor/marked.js - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language