ICIJ/prophecies

View on GitHub

Showing 15 of 79 total issues

Function getTaskFilters has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

getTaskFilters(task) {
return !task
? {}
: {
predictedValues: {
Severity: Major
Found in prophecies/apps/frontend/src/mixins/task-record-review-filters.js - About 4 hrs to fix

    Task has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Task(models.Model):
    objects = TaskManager()
     
    name = models.CharField(max_length=100)
    description = models.CharField(max_length=100)
    Severity: Minor
    Found in prophecies/core/models/task.py - About 2 hrs to fix

      Core has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Core extends Behaviors {
      /**
      * Create an application
      * @param {Object} LocalVue - The Vue class to instantiate the application with.
      */
      Severity: Minor
      Found in prophecies/apps/frontend/src/core/Core.js - About 2 hrs to fix

        TaskRecordReview has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class TaskRecordReview(models.Model):
        objects = TaskRecordReviewManager()
         
        class Meta:
        unique_together = ('task_record_id', 'checker_id', 'round')
        Severity: Minor
        Found in prophecies/core/models/task_record_review.py - About 2 hrs to fix

          File task.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from actstream import action
          from colorfield.fields import ColorField
          from django.apps import apps
          from django.core.cache import cache
          from django.contrib.auth.models import User
          Severity: Minor
          Found in prophecies/core/models/task.py - About 2 hrs to fix

            File task_record_review.py has 259 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            from django.contrib.auth.models import User
            from django.db import models
            from django.db.models import Count, F, signals
            from django.core.exceptions import ValidationError
            from django.utils import timezone
            Severity: Minor
            Found in prophecies/core/models/task_record_review.py - About 2 hrs to fix

              Function __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def __init__(self, dict_or_list):
              if type(dict_or_list) == dict:
              for key, value in dict_or_list.items():
              if type(value) == dict:
              setattr(self, key, ExtendedNamespace(value))
              Severity: Minor
              Found in prophecies/core/contrib/namespace.py - About 55 mins to fix

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

              def filter_choice_queryset(
              Severity: Minor
              Found in prophecies/apps/api/views/task_record_review.py - About 45 mins to fix

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

                def map_provider_groups(strategy, details, user, *args, **kwargs):
                Severity: Minor
                Found in prophecies/core/oauth2_provider.py - About 35 mins to fix

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

                  def notify_mentioned_users(author, users, action_object):
                  for user in users:
                  if author != user:
                  action, created = get_or_create_mention_action(author, user, action_object)
                  if created:
                  Severity: Minor
                  Found in prophecies/core/contrib/mentions.py - About 25 mins to fix

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

                  def get_path(mixed, path, default=None):
                  def get(d, key):
                  if isinstance(d, dict):
                  return d.get(key, default)
                  elif isinstance(d, list):
                  Severity: Minor
                  Found in prophecies/core/contrib/namespace.py - About 25 mins to fix

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

                  def signal_notify_mentioned_users(sender, instance, **kwargs): # pylint: disable=unused-argument
                  for mention in instance.mentions:
                  user = mention.get('user')
                  if user is not None:
                  act, created = get_or_create_mention_action(instance.creator, user, instance)
                  Severity: Minor
                  Found in prophecies/core/models/tip.py - About 25 mins to fix

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

                  def clean(self):
                  super().clean()
                  if self.is_valid():
                  for object in self.task_record_reviews():
                  object.check_user_is_authorized()
                  Severity: Minor
                  Found in prophecies/core/forms/task_record_assign_form.py - About 25 mins to fix

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

                  def save(self):
                  user = self.context.get("request").user
                  if "choice" in self.validated_data:
                  choice = self.validated_data.get("choice", None)
                  has_choice = not choice is None
                  Severity: Minor
                  Found in prophecies/apps/api/views/task_record_review.py - About 25 mins to fix

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

                  def signal_notify_mentioned_users(sender, instance, **kwargs): # pylint: disable=unused-argument
                  for mention in instance.mentions:
                  user = mention.get('user')
                  if user is not None:
                  action, created = get_or_create_mention_action(instance.checker, user, instance)
                  Severity: Minor
                  Found in prophecies/core/models/task_record_review.py - About 25 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language