codeforamerica/intake

View on GitHub

Showing 66 of 168 total issues

Function drawBarChart has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function drawBarChart (chart, chartConfig, sizes, data, xScale, yScale) {
Severity: Minor
Found in intake/static/intake/js/org_charts.js - About 45 mins to fix

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

    def render_application_transfer_message(
    Severity: Minor
    Found in intake/services/transfers_service.py - About 35 mins to fix

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

      def test_crudevent_has_matching_property(
      Severity: Minor
      Found in features/steps/audit_steps.py - About 35 mins to fix

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

        def test_crudevent_property_contains(
        Severity: Minor
        Found in features/steps/audit_steps.py - About 35 mins to fix

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

          def Style(name, font='Helvetica', size=12, leading=None, color=colors.black):
          Severity: Minor
          Found in printing/pdf_form_display.py - About 35 mins to fix

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

                def __init__(self, *args, files=None, validate=False,
            Severity: Minor
            Found in formation/form_base.py - About 35 mins to fix

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

                  getCookie: function(name) {
                    var cookieValue = null;
                    if (document.cookie && document.cookie !== '') {
                      var cookies = document.cookie.split(';');
                      for (var i = 0; i < cookies.length; i++) {
              Severity: Minor
              Found in intake/static/intake/js/utils.js - 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 handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handle(self, *args, **kwargs):
                      now = timezone.now()
                      oldest_allowed_submission_date = now - timedelta(days=30)
                      for org in Organization.objects.all():
                          latest_login = User.objects.filter(

              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 handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handle(self, *args, **kwargs):
                      filename = '/tmp/database_export.csv'
                      with open(filename, 'w') as csvfile:
                          writer = csv.writer(
                              csvfile,
              Severity: Minor
              Found in helper_commands/management/commands/export_csv.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_display_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_display_value(self, strftime_format=None):
                      value = super().get_display_value(strftime_format=strftime_format)
                      if value:
                          local_now = timezone.now()
                          time_delta = local_now - self.get_current_value()
              Severity: Minor
              Found in formation/fields.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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get(self, request, *args, **kwargs):
                      try:
                          self.app_ids = query_params.get_ids_from_query_params(request)
                      except InvalidQueryParamsError as err:
                          return not_allowed(request)
              Severity: Minor
              Found in intake/views/base_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

              Avoid too many return statements within this function.
              Open

                      return Response(data=updated_tags, status=201)
              Severity: Major
              Found in intake/views/tag_views.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return self.request_valid(request, *args, **kwargs)
                Severity: Major
                Found in intake/views/base_views.py - About 30 mins to fix

                  Function update_tags_for_submission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def update_tags_for_submission(user_id, submission_id, tags_input_string):
                      """Updates the set of tags tied to a submission.
                  
                          Returns the updated set of tags tag names for the submission
                      """
                  Severity: Minor
                  Found in intake/services/tags.py - About 25 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 init_templates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def init_templates(self):
                          if not jinja.env:
                              raise JinjaNotInitializedError(
                                  "the jinja environment has not been initialized")
                          for key, value in self.template_and_path_args.items():
                  Severity: Minor
                  Found in intake/notifications.py - About 25 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 notify_applicant has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def notify_applicant(self, unsafe_data_diff):
                          profile = self.request.user.profile
                          org = profile.organization
                          name = safestring.mark_safe('the ' + org.name if org.slug != 'cfa' else org.name)
                          contact_info = safestring.mark_safe(org.get_contact_info_message())
                  Severity: Minor
                  Found in intake/views/app_edit_view.py - About 25 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 to_representation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def to_representation(self, app, *args, **kwargs):
                          app_fields = super().to_representation(app, *args, **kwargs)
                          display_form, letter = get_display_form_for_csv_download(app)
                          data = OrderedDict(id=app.form_submission_id)
                          data['Link'] = app.form_submission.get_external_url()
                  Severity: Minor
                  Found in intake/serializers/application_serializers.py - About 25 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_context_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_context_data(self, *args, **kwargs):
                          context = super().get_context_data(*args, **kwargs)
                          self.submission = self.submissions[0]
                          display_form, letter_display = \
                              DisplayFormService.get_display_form_for_user_and_submission(
                  Severity: Minor
                  Found in intake/views/app_detail_views.py - About 25 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 process_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def process_request(self, request):
                          if not is_a_monitoring_request(request):
                              referrer = request.META.get('HTTP_REFERER')
                              if referrer:
                                  referrer_host = urlparse(referrer).netloc
                  Severity: Minor
                  Found in intake/middleware.py - About 25 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 total_display_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def total_display_data(total_app_data_by_week, year_weeks):
                      """
                      Generate a dictionary of data suitable for our view to render total stats
                      across all organizations that receive applications. It includes metadata
                      about the organization whose stats are being displayed, a cumulative total
                  Severity: Minor
                  Found in intake/services/statistics.py - About 25 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