18F/openFEC-web-app

View on GitHub

Showing 67 of 188 total issues

File committee-single.js has 609 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/* global document, context */

var $ = require('jquery');
Severity: Major
Found in static/js/pages/committee-single.js - About 1 day to fix

    File constants.py has 604 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from collections import OrderedDict
    
    START_YEAR = 1979
    END_YEAR = 2018
    DEFAULT_TIME_PERIOD = 2018
    Severity: Major
    Found in openfecwebapp/constants.py - About 1 day to fix

      File columns.js has 602 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      var _ = require('underscore');
      
      var columnHelpers = require('./column-helpers');
      Severity: Major
      Found in static/js/modules/columns.js - About 1 day to fix

        File tables.js has 569 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        var $ = require('jquery');
        var _ = require('underscore');
        
        
        Severity: Major
        Found in static/js/modules/tables.js - About 1 day to fix

          File elections.js has 500 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          /* global document, context */
          
          var d3 = require('d3');
          Severity: Minor
          Found in static/js/pages/elections.js - About 1 day to fix

            File routes.py has 456 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import http
            
            import datetime
            import re
            
            
            Severity: Minor
            Found in openfecwebapp/routes.py - About 6 hrs to fix

              File candidate-single.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict';
              
              /* global require, document, context, WEBMANAGER_EMAIL */
              
              var $ = require('jquery');
              Severity: Minor
              Found in static/js/pages/candidate-single.js - About 6 hrs to fix

                Function Tags has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                Open

                function Tags(props) {
                  const namedFields = [];
                  Array.prototype.push.apply(namedFields, requestorOptions);
                  Array.prototype.push.apply(namedFields, documentTypes);
                  namedFields.push({value: 'ao_is_pending', text: "Pending"});
                Severity: Minor
                Found in static/js/legal/Tags.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

                Function initContributionsTables has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function initContributionsTables() {
                  var $allTransactions = $('table[data-type="individual-contributions"]');
                  var $contributionSize = $('table[data-type="contribution-size"]');
                  var $contributorState = $('table[data-type="contributor-state"]');
                  var displayCycle = helpers.formatCycleRange($allTransactions.data('cycle'), 2);
                Severity: Major
                Found in static/js/pages/candidate-single.js - About 4 hrs to fix

                  Function load_legal_mur has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def load_legal_mur(mur_no):
                  
                      url = '/legal/docs/murs/'
                      mur = _call_api(url, parse.quote(mur_no))
                  
                  
                  Severity: Minor
                  Found in openfecwebapp/api_caller.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 filterSuccessUpdates has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function filterSuccessUpdates(changeCount) {
                    // on filter change update:
                    // - loading/success status
                    // - count change message
                  
                  
                  Severity: Minor
                  Found in static/js/modules/tables.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 Tags has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function Tags(props) {
                    const namedFields = [];
                    Array.prototype.push.apply(namedFields, requestorOptions);
                    Array.prototype.push.apply(namedFields, documentTypes);
                    namedFields.push({value: 'ao_is_pending', text: "Pending"});
                  Severity: Major
                  Found in static/js/legal/Tags.js - About 3 hrs to fix

                    Function filterSuccessUpdates has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function filterSuccessUpdates(changeCount) {
                      // on filter change update:
                      // - loading/success status
                      // - count change message
                    
                    
                    Severity: Major
                    Found in static/js/modules/tables.js - About 2 hrs to fix

                      Function SearchResults has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function SearchResults(props) {
                        function highlights(advisory_opinion) {
                          return {__html: '…' + advisory_opinion.highlights }
                        }
                      
                      
                      Severity: Major
                      Found in static/js/legal/SearchResults.js - About 2 hrs to fix

                        File line-chart.js has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        'use strict';
                        
                        /* global module, DEFAULT_TIME_PERIOD */
                        var $ = require('jquery');
                        var _ = require('underscore');
                        Severity: Minor
                        Found in static/js/modules/line-chart.js - About 2 hrs to fix

                          File helpers.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          'use strict';
                          
                          /* global Intl, BASE_PATH, API_LOCATION, API_VERSION, API_KEY */
                          
                          var URI = require('urijs');
                          Severity: Minor
                          Found in static/js/modules/helpers.js - About 2 hrs to fix

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

                            def render_committee(committee, candidates, cycle, redirect_to_previous):
                                # committee fields will be top-level in the template
                                tmpl_vars = committee
                            
                                tmpl_vars['parent'] = 'data'
                            Severity: Minor
                            Found in openfecwebapp/views.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 election-search.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            'use strict';
                            
                            /* global window */
                            
                            var $ = require('jquery');
                            Severity: Minor
                            Found in static/js/modules/election-search.js - About 2 hrs to fix

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

                              import datetime
                              
                              import furl
                              
                              from flask.views import MethodView
                              Severity: Minor
                              Found in openfecwebapp/views.py - About 2 hrs to fix

                                Function stateMap has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function stateMap($elm, data, width, height, min, max, addLegend, addTooltips) {
                                  var svg = d3.select($elm[0])
                                    .append('svg')
                                      .attr('width', width)
                                      .attr('height', height);
                                Severity: Major
                                Found in static/js/modules/maps.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language