ICIJ/prophecies

View on GitHub

Showing 70 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    Severity: Major
    Found in prophecies/core/migrations/0005_auto_20210830_1535.py and 1 other location - About 4 hrs to fix
    prophecies/core/migrations/0008_auto_20210907_1216.py on lines 0..20

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    Severity: Major
    Found in prophecies/core/migrations/0008_auto_20210907_1216.py and 1 other location - About 4 hrs to fix
    prophecies/core/migrations/0005_auto_20210830_1535.py on lines 0..20

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    save(id, { attributes = {}, relationships = {} } = {}) {
    const type = 'TaskRecord'
    const data = { type, id, attributes, relationships }
    return this.put(`${id}/`, { data }, { headers: defaultHeaders() })
    },
    Severity: Major
    Found in prophecies/apps/frontend/src/models/TaskRecord.js and 1 other location - About 3 hrs to fix
    prophecies/apps/frontend/src/models/TaskRecordReview.js on lines 47..51

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    save(id, { attributes = {}, relationships = {} } = {}) {
    const type = 'TaskRecordReview'
    const data = { type, id, attributes, relationships }
    return this.put(`${id}/`, { data }, { headers: defaultHeaders() })
    },
    Severity: Major
    Found in prophecies/apps/frontend/src/models/TaskRecordReview.js and 1 other location - About 3 hrs to fix
    prophecies/apps/frontend/src/models/TaskRecord.js on lines 37..41

    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

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

              def get_queryset(self):
              if not self.request.user.is_authenticated:
              return Task.objects.none()
              return super().get_queryset().user_scope(self.request.user)
              Severity: Major
              Found in prophecies/apps/api/views/task.py and 4 other locations - About 1 hr to fix
              prophecies/apps/api/views/action_aggregate.py on lines 46..49
              prophecies/apps/api/views/task_user_choice_statistics.py on lines 61..64
              prophecies/apps/api/views/task_user_statistics.py on lines 55..58
              prophecies/apps/api/views/tip.py on lines 65..68

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

              def get_queryset(self):
              if not self.request.user.is_authenticated:
              return TaskUserChoiceStatistics.objects.none()
              return super().get_queryset().user_scope(self.request.user)
              Severity: Major
              Found in prophecies/apps/api/views/task_user_choice_statistics.py and 4 other locations - About 1 hr to fix
              prophecies/apps/api/views/action_aggregate.py on lines 46..49
              prophecies/apps/api/views/task.py on lines 136..139
              prophecies/apps/api/views/task_user_statistics.py on lines 55..58
              prophecies/apps/api/views/tip.py on lines 65..68

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

              def get_queryset(self):
              if not self.request.user.is_authenticated:
              return TaskUserStatistics.objects.none()
              return super().get_queryset().user_scope(self.request.user)
              Severity: Major
              Found in prophecies/apps/api/views/task_user_statistics.py and 4 other locations - About 1 hr to fix
              prophecies/apps/api/views/action_aggregate.py on lines 46..49
              prophecies/apps/api/views/task.py on lines 136..139
              prophecies/apps/api/views/task_user_choice_statistics.py on lines 61..64
              prophecies/apps/api/views/tip.py on lines 65..68

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              migrations.AlterField(
              model_name='taskrecord',
              name='status',
              field=models.CharField(blank=True, choices=[('UNASSIGNED', 'Unassigned'), ('ASSIGNED', 'Assigned'), ('DONE', 'Done')], default='UNASSIGNED', help_text="Status of the record. Set to done after it passes all task's rounds", max_length=10),
              prophecies/core/migrations/0009_task_status.py on lines 11..15

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

              def get_queryset(self):
              if not self.request.user.is_authenticated:
              return ActionAggregate.objects.none()
              return super().get_queryset().user_scope(self.request.user)
              Severity: Major
              Found in prophecies/apps/api/views/action_aggregate.py and 4 other locations - About 1 hr to fix
              prophecies/apps/api/views/task.py on lines 136..139
              prophecies/apps/api/views/task_user_choice_statistics.py on lines 61..64
              prophecies/apps/api/views/task_user_statistics.py on lines 55..58
              prophecies/apps/api/views/tip.py on lines 65..68

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

              def get_queryset(self):
              if not self.request.user.is_authenticated:
              return Tip.objects.none()
              return super().get_queryset().user_scope(self.request.user)
              Severity: Major
              Found in prophecies/apps/api/views/tip.py and 4 other locations - About 1 hr to fix
              prophecies/apps/api/views/action_aggregate.py on lines 46..49
              prophecies/apps/api/views/task.py on lines 136..139
              prophecies/apps/api/views/task_user_choice_statistics.py on lines 61..64
              prophecies/apps/api/views/task_user_statistics.py on lines 55..58

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              operations = [
              migrations.AddField(
              model_name='task',
              name='status',
              field=models.CharField(blank=True, choices=[('OPEN', 'Open'), ('CLOSED', 'Closed'), ('LOCKED', 'Locked')],
              Severity: Major
              Found in prophecies/core/migrations/0009_task_status.py and 1 other location - About 1 hr to fix
              prophecies/core/migrations/0030_alter_task_template_setting_alter_taskrecord_status_and_more.py on lines 23..26

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              static apiConfig = {
              baseURL: `${settings.apiUrl}/tasks/`,
              dataTransformer: responseNormalizer,
              actions: {
              find(id, config = {}) {
              Severity: Major
              Found in prophecies/apps/frontend/src/models/Task.js and 2 other locations - About 1 hr to fix
              prophecies/apps/frontend/src/models/ChoiceGroup.js on lines 20..28
              prophecies/apps/frontend/src/models/TaskRecordMedia.js on lines 25..33

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              static apiConfig = {
              baseURL: `${settings.apiUrl}/choice-groups/`,
              dataTransformer: responseNormalizer,
              actions: {
              find(id, config = {}) {
              Severity: Major
              Found in prophecies/apps/frontend/src/models/ChoiceGroup.js and 2 other locations - About 1 hr to fix
              prophecies/apps/frontend/src/models/Task.js on lines 55..63
              prophecies/apps/frontend/src/models/TaskRecordMedia.js on lines 25..33

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              migrations.AddField(
              model_name='task',
              name='template_setting',
              field=models.OneToOneField(blank=True, help_text='Each template type has its own set of settings.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='task', to='core.tasktemplatesetting'),
              Severity: Major
              Found in prophecies/core/migrations/0029_auto_20240112_1220.py and 1 other location - About 1 hr to fix
              prophecies/core/migrations/0030_alter_task_template_setting_alter_taskrecord_status_and_more.py on lines 18..21
              Severity
              Category
              Status
              Source
              Language