loomio/loomio

View on GitHub

Showing 471 of 471 total issues

Method update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.update(poll:, params:, actor:)
    actor.ability.authorize! :update, poll

    UserInviter.authorize!(
      user_ids: params[:recipient_user_ids],
Severity: Minor
Found in app/services/poll_service.rb - About 1 hr to fix

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

      def hide
        @group = current_user.adminable_groups.find_by!(id: params[:group_id])
    
        if DiscussionTemplateService.group_templates(group: @group).any? {|pt| pt.key == params[:key]}
          @group = current_user.adminable_groups.find_by(id: params[:group_id])
    Severity: Major
    Found in app/controllers/api/v1/discussion_templates_controller.rb and 1 other location - About 1 hr to fix
    app/controllers/api/v1/poll_templates_controller.rb on lines 77..88

    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 54.

    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

      def hide
        @group = current_user.adminable_groups.find_by!(id: params[:group_id])
    
        if PollTemplateService.group_templates(group: @group).any? {|pt| pt.key == params[:key]}
          @group = current_user.adminable_groups.find_by(id: params[:group_id])
    Severity: Major
    Found in app/controllers/api/v1/poll_templates_controller.rb and 1 other location - About 1 hr to fix
    app/controllers/api/v1/discussion_templates_controller.rb on lines 104..115

    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 54.

    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

    Method payload has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def payload
          @payload ||= {
            version:             Loomio::Version.current,
            release:             AppConfig.release,
            systemNotice:        ENV['LOOMIO_SYSTEM_NOTICE'],
    Severity: Minor
    Found in app/models/boot/site.rb - About 1 hr to fix

      Method default_templates has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.default_templates
          AppConfig.poll_templates.map do |key, raw_attrs|
            raw_attrs[:key] = key
            attrs = {}
      
      
      Severity: Minor
      Found in app/services/poll_template_service.rb - About 1 hr to fix

        Method perform has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def perform
            Discussion.where(template: true).each do |discussion|
              template = DiscussionTemplate.new(discussion.slice(
                  :group_id,
                  :author_id,
        Severity: Minor
        Found in app/workers/convert_discussion_templates_worker.rb - About 1 hr to fix

          Function defaultValues has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            defaultValues() {
              return {
                id: null,
                key: null,
                private: true,
          Severity: Minor
          Found in vue/src/shared/models/discussion_model.js - About 1 hr to fix

            Function baseConstructor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              baseConstructor(recordStore) {
                this.views = [];
                this.missingIds = [];
                this.fetchedIds = [];
            
            
            Severity: Minor
            Found in vue/src/shared/record_store/base_records_interface.js - About 1 hr to fix

              Function constructor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor() {
                  const defaults = {
                    id: null,
                    title: 'No thread',
                    description: '',
              Severity: Minor
              Found in vue/src/shared/models/null_discussion_model.js - About 1 hr to fix

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

                  reopen(thread) {
                    return thread.reopen().then(() => {
                      return Flash.success("discussion.closed.reopened", {}, 'undo', () => this.close(thread));
                    });
                  }
                Severity: Major
                Found in vue/src/shared/services/thread_service.js and 2 other locations - About 1 hr to fix
                vue/src/shared/services/thread_service.js on lines 341..345
                vue/src/shared/services/thread_service.js on lines 347..351

                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 58.

                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

                      discard_comment: {
                        name: 'common.action.discard',
                        icon: 'mdi-delete-outline',
                        menu: true,
                        canPerform() { return AbilityService.canDiscardComment(comment); },
                Severity: Major
                Found in vue/src/shared/services/comment_service.js and 1 other location - About 1 hr to fix
                vue/src/shared/services/comment_service.js on lines 118..124

                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 58.

                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

                      local: {
                        find: {
                          discussionId: this.discussion.id,
                          positionKey: {$jlt: positionKey}
                        },
                Severity: Major
                Found in vue/src/shared/loaders/thread_loader.js and 1 other location - About 1 hr to fix
                vue/src/shared/loaders/thread_loader.js on lines 237..244

                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 58.

                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 3 locations. Consider refactoring.
                Open

                  dismiss(thread) {
                    return thread.dismiss().then(() => {
                      return Flash.success("dashboard_page.thread_dismissed", {}, 'undo', () => this.recall(thread));
                    });
                  }
                Severity: Major
                Found in vue/src/shared/services/thread_service.js and 2 other locations - About 1 hr to fix
                vue/src/shared/services/thread_service.js on lines 335..339
                vue/src/shared/services/thread_service.js on lines 347..351

                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 58.

                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

                      undiscard_comment: {
                        name: 'common.action.restore',
                        icon: 'mdi-delete-restore',
                        menu: true,
                        canPerform() { return AbilityService.canUndiscardComment(comment); },
                Severity: Major
                Found in vue/src/shared/services/comment_service.js and 1 other location - About 1 hr to fix
                vue/src/shared/services/comment_service.js on lines 110..116

                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 58.

                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

                      local: {
                        find: {
                          discussionId: this.discussion.id,
                          positionKey: {$jgte: positionKey}
                        },
                Severity: Major
                Found in vue/src/shared/loaders/thread_loader.js and 1 other location - About 1 hr to fix
                vue/src/shared/loaders/thread_loader.js on lines 255..262

                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 58.

                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 3 locations. Consider refactoring.
                Open

                  recall(thread) {
                    return thread.recall().then(() => {
                      return Flash.success("dashboard_page.thread_recalled", {}, 'undo', () => this.dismiss(thread));
                    });
                  }
                Severity: Major
                Found in vue/src/shared/services/thread_service.js and 2 other locations - About 1 hr to fix
                vue/src/shared/services/thread_service.js on lines 335..339
                vue/src/shared/services/thread_service.js on lines 341..345

                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 58.

                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

                Method group_privacy= has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def group_privacy=(term)
                    case term
                    when 'open'
                      self.is_visible_to_public = true
                      self.discussion_privacy_options = 'public_only'
                Severity: Minor
                Found in app/models/concerns/group_privacy.rb - About 1 hr to fix

                  Function importREADY has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    importREADY(data) {
                      if (isEmpty(data)) { return []; }
                  
                      // hack just to get around AMS
                      if (data['parentGroups'] != null) {
                  Severity: Minor
                  Found in vue/src/shared/record_store/record_store.js - About 1 hr to fix

                    Method nil_methods has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def nil_methods
                        %w(
                          parent
                          id
                          key
                    Severity: Minor
                    Found in app/models/concerns/null/group.rb - About 1 hr to fix

                      Function addLoadUnreadRule has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        addLoadUnreadRule() {
                          if (this.discussion.updatedAt > this.discussion.lastReadAt) {
                            this.addRule({
                              name: "context updated",
                              local: {
                      Severity: Minor
                      Found in vue/src/shared/loaders/thread_loader.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language