Showing 95 of 177 total issues

Function updateHistogram has 258 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateHistogram(rootEl, data, proposedPrice, showTransition) {
  const width = 720;
  const height = 300;
  const pad = [120, 15, 60, 60];
  const top = pad[0];
Severity: Major
Found in frontend/source/js/data-explorer/components/histogram.jsx - About 1 day to fix

    File models.py has 454 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import bleach
    import csv
    from datetime import datetime
    from decimal import Decimal
    
    
    Severity: Minor
    Found in contracts/models.py - About 6 hrs to fix

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

      import bleach
      import csv
      from decimal import Decimal
      from textwrap import dedent
      
      
      Severity: Minor
      Found in api/views.py - About 6 hrs to fix

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

        def command(verbosity: int, testtype: List[str]) -> None:
            '''
            Test and lint everything!
        
            Optionally specify one or more test names to run only those tests.
        Severity: Minor
        Found in meta/management/commands/ultratest.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 histogram.jsx has 405 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import PropTypes from 'prop-types';
        import React from 'react';
        import { connect } from 'react-redux';
        
        import { select } from 'd3-selection';
        Severity: Minor
        Found in frontend/source/js/data-explorer/components/histogram.jsx - About 5 hrs to fix

          File admin.py has 399 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import os
          import re
          from django.contrib import admin
          from django.http import HttpResponse, HttpResponseForbidden
          from django.db import models, transaction
          Severity: Minor
          Found in data_capture/admin.py - About 5 hrs to fix

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

                def make_contract(cls, line, upload_source=None):
                    if line[0]:
                        # create contract record, unique to vendor, labor cat
                        idv_piid = line[11]
                        vendor_name = line[10]
            Severity: Minor
            Found in contracts/loaders/region_10.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

            Function get_contracts_queryset has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_contracts_queryset(request_params, wage_field):
                """
                Filters and returns contracts based on query params
            
                Args:
            Severity: Minor
            Found in api/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 settings.py has 367 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            Django settings for calc project.
            
            For more information on this file, see
            https://docs.djangoproject.com/en/1.7/topics/settings/
            Severity: Minor
            Found in calc/settings.py - About 4 hrs to fix

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

                render() {
                  const prefixId = name => `${this.props.idPrefix}${name}`;
              
                  return (
                    <form
              Severity: Major
              Found in frontend/source/js/data-explorer/components/app.jsx - About 4 hrs to fix

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

                def handle_cancel(*args, redirect_name='index', key_prefix='data_capture:'):
                    '''
                    Decorator to handle cancel behavior in Data Capture flows.
                    The associated request's POST data is checked for a 'cancel' key,
                    and, if found, all session keys that start with `key_prefix`
                Severity: Minor
                Found in data_capture/decorators.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

                Function attachedCallback has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  attachedCallback() {
                    const $el = $(this);
                    const $input = $('input', $el);
                
                    if ($input.length !== 1 || $input.attr('is') !== 'upload-input') {
                Severity: Major
                Found in frontend/source/js/data-capture/upload.js - About 3 hrs to fix

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

                    render() {
                      const { levels, idPrefix } = this.props;
                      const inputs = Object.keys(EDU_LABELS).map((value) => {
                        const id = idPrefix + value;
                        return (
                  Severity: Major
                  Found in frontend/source/js/data-explorer/components/education-level.jsx - About 3 hrs to fix

                    File price_list_upload.py has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import json
                    
                    from django.views.decorators.http import require_http_methods
                    from django.shortcuts import redirect, render
                    from django.template.loader import render_to_string
                    Severity: Minor
                    Found in data_capture/views/price_list_upload.py - About 3 hrs to fix

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

                      function updateHistogram(rootEl, data, proposedPrice, showTransition) {
                        const width = 720;
                        const height = 300;
                        const pad = [120, 15, 60, 60];
                        const top = pad[0];
                      Severity: Minor
                      Found in frontend/source/js/data-explorer/components/histogram.jsx - 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 models.py has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import hashlib
                      import logging
                      
                      from django.db import models
                      from django.contrib.auth.models import User
                      Severity: Minor
                      Found in data_capture/models.py - About 2 hrs to fix

                        Function multi_phrase_search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def multi_phrase_search(self, query, query_by=None, *args, **kwargs):
                                """
                                Given a query as string, runs it through clean_search to get a list of search terms,
                                then returns a matching queryset of Contract objects for each of those terms.
                        
                        
                        Severity: Minor
                        Found in contracts/models.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 entrypoint has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def entrypoint(argv):  # type: (List[str]) -> None
                            '''
                            This is a Docker entrypoint that configures the container to run
                            as the same uid of the user on the host container, rather than
                            the Docker default of root. Aside from following security best
                        Severity: Minor
                        Found in docker_django_management.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 styleguide.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import os.path
                        from html.parser import HTMLParser
                        from textwrap import dedent
                        from inspect import getsourcefile
                        from importlib import import_module
                        Severity: Minor
                        Found in styleguide/templatetags/styleguide.py - About 2 hrs to fix

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

                            render() {
                              const [min, max] = this.state.sliderVal;
                          
                              const rangeId = `${this.props.idPrefix}range`;
                              const minId = `${this.props.idPrefix}min`;
                          Severity: Major
                          Found in frontend/source/js/data-explorer/components/experience.jsx - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language