loomio/loomio

View on GitHub

Showing 469 of 469 total issues

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

      destroy: {
        icon: 'mdi-delete',
        name: 'common.action.delete',
        menu: true,
        canPerform() { return pollTemplate.id && group.adminsInclude(Session.user()); },
Severity: Major
Found in vue/src/shared/services/poll_template_service.js and 1 other location - About 5 hrs to fix
vue/src/shared/services/discussion_template_service.js on lines 64..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 146.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      destroy: {
        icon: 'mdi-delete',
        name: 'common.action.delete',
        menu: true,
        canPerform() { return discussionTemplate.id && group.adminsInclude(Session.user()); },
Severity: Major
Found in vue/src/shared/services/discussion_template_service.js and 1 other location - About 5 hrs to fix
vue/src/shared/services/poll_template_service.js on lines 76..98

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 146.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File record_cloner.rb has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class RecordCloner
  def initialize(recorded_at:)
    @recorded_at = recorded_at
    @cache = {}
  end
Severity: Minor
Found in app/services/record_cloner.rb - About 5 hrs to fix

    BaseModel has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class BaseModel {
      static singular = 'undefinedSingular';
      static plural = 'undefinedPlural';
    
      static eventTypeMap = {
    Severity: Minor
    Found in vue/src/shared/record_store/base_model.js - About 5 hrs to fix

      File fake_data_helper.rb has 387 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Dev::FakeDataHelper
        private
      
        def saved(obj)
          obj.tap(&:save!)
      Severity: Minor
      Found in app/helpers/dev/fake_data_helper.rb - About 5 hrs to fix

        Function actions has 129 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          actions(comment, vm, event) {
            const isOwnComment = comment.authorId === Session.userId;
            return {
              translate_comment: {
                name: 'common.action.translate',
        Severity: Major
        Found in vue/src/shared/services/comment_service.js - About 5 hrs to fix

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

            constructor(...args) {
              super(...args);
              this.archive = this.archive.bind(this);
              this.export = this.export.bind(this);
              this.exportCSV = this.exportCSV.bind(this);
          Severity: Major
          Found in vue/src/shared/models/group_model.js and 1 other location - About 5 hrs to fix
          vue/src/shared/models/poll_model.js on lines 18..25

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 135.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

            constructor(...args) {
              super(...args);
              this.close = this.close.bind(this);
              this.reopen = this.reopen.bind(this);
              this.addToThread = this.addToThread.bind(this);
          Severity: Major
          Found in vue/src/shared/models/poll_model.js and 1 other location - About 5 hrs to fix
          vue/src/shared/models/group_model.js on lines 13..20

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 135.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Class ApplicationSerializer has 37 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApplicationSerializer < ActiveModel::Serializer
            embed :ids, include: true
          
            def scope
              super || {}
          Severity: Minor
          Found in app/serializers/application_serializer.rb - About 4 hrs to fix

            Class User has 37 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class User < ApplicationRecord
              include CustomCounterCache::Model
              include ReadableUnguessableUrls
              include MessageChannel
              include HasExperiences
            Severity: Minor
            Found in app/models/user.rb - About 4 hrs to fix

              Method initialize has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(user)
                  super(user)
              
                  can :vote_in, ::Poll do |poll|
                    user.is_logged_in? &&
              Severity: Minor
              Found in app/models/ability/poll.rb - 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

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

                    delete_document: {
                      icon: 'mdi-delete',
                      name: 'common.action.delete',
                      canPerform() {
                        return attachment.isA('document') && AbilityService.canAdminister(attachment.group());
              Severity: Major
              Found in vue/src/shared/services/attachment_service.js and 1 other location - About 4 hrs to fix
              vue/src/shared/services/attachment_service.js on lines 11..34

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 127.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                    delete_attachment: {
                      icon: 'mdi-delete',
                      name: 'common.action.delete',
                      canPerform() {
                        return attachment.isA('attachment') && AbilityService.canAdminister(attachment.group());
              Severity: Major
              Found in vue/src/shared/services/attachment_service.js and 1 other location - About 4 hrs to fix
              vue/src/shared/services/attachment_service.js on lines 36..59

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 127.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              ThreadLoader has 34 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export default class ThreadLoader {
                constructor(discussion) {
                  this.discussion = discussion;
                  this.reset();
                }
              Severity: Minor
              Found in vue/src/shared/loaders/thread_loader.js - About 4 hrs to fix

                File poll_model.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import BaseModel        from '@/shared/record_store/base_model';
                import AppConfig        from '@/shared/services/app_config';
                import Session          from '@/shared/services/session';
                import HasDocuments     from '@/shared/mixins/has_documents';
                import HasTranslations  from '@/shared/mixins/has_translations';
                Severity: Minor
                Found in vue/src/shared/models/poll_model.js - About 4 hrs to fix

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

                        hide: {
                          icon: 'mdi-eye-off',
                          name: 'common.action.hide',
                          menu: true,
                          canPerform() { 
                  Severity: Major
                  Found in vue/src/shared/services/poll_template_service.js and 1 other location - About 4 hrs to fix
                  vue/src/shared/services/discussion_template_service.js on lines 88..98

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 118.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                        hide: {
                          icon: 'mdi-eye-off',
                          name: 'common.action.hide',
                          menu: true,
                          canPerform() { 
                  Severity: Major
                  Found in vue/src/shared/services/discussion_template_service.js and 1 other location - About 4 hrs to fix
                  vue/src/shared/services/poll_template_service.js on lines 100..110

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 118.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                        unhide: {
                          icon: 'mdi-eye',
                          name: 'common.action.unhide',
                          menu: true,
                          canPerform() { 
                  Severity: Major
                  Found in vue/src/shared/services/discussion_template_service.js and 1 other location - About 4 hrs to fix
                  vue/src/shared/services/poll_template_service.js on lines 112..122

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 116.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                        unhide: {
                          icon: 'mdi-eye',
                          name: 'common.action.unhide',
                          menu: true,
                          canPerform() { 
                  Severity: Major
                  Found in vue/src/shared/services/poll_template_service.js and 1 other location - About 4 hrs to fix
                  vue/src/shared/services/discussion_template_service.js on lines 100..110

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 116.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  NullGroupModel has 32 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export default class NullGroupModel {
                    static singular = 'group';
                    static plural = 'groups';
                    static subscription = {};
                  
                  
                  Severity: Minor
                  Found in vue/src/shared/models/null_group_model.js - About 4 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language