loomio/loomio

View on GitHub

Showing 257 of 469 total issues

File emoji_table.js has 575 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export default {
  'common': {
    'slight_smile': '🙂',
    'heart': '❤️',
    'tada': '🎉',
Severity: Major
Found in vue/src/shared/helpers/emoji_table.js - About 1 day to fix

    Method import has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.import(filename_or_url, reset_keys: false)
        group_ids = []
        migrate_ids = {}
    
        if URI.parse(filename_or_url).class == URI::Generic
    Severity: Minor
    Found in app/services/group_export_service.rb - About 1 day 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 actions has 227 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      actions(group) {
        const membership = group.membershipFor(Session.user());
        
        return {
          email_group: {
    Severity: Major
    Found in vue/src/shared/services/group_service.js - About 1 day to fix

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

        actions(poll, vm, event) {
          if (!poll || !poll.config()) { return {}; }
          return {
            translate_poll: {
              icon: 'mdi-translate',
      Severity: Major
      Found in vue/src/shared/services/poll_service.js - About 1 day to fix

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

          actions(discussion, vm) {
            return {
              make_a_copy: {
                icon: 'mdi-content-copy',
                name: 'templates.make_a_copy',
        Severity: Major
        Found in vue/src/shared/services/thread_service.js - About 1 day to fix

          `` has 61 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default new class AbilityService {
            isNotEmailVerified() {
              return Session.isSignedIn() && !Session.user().emailVerified;
            }
          
          
          Severity: Major
          Found in vue/src/shared/services/ability_service.js - About 1 day to fix

            Method route has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.route(email)
                return nil unless email.route_address
                return nil if email.released
                return nil if email.sender_hostname.downcase == ENV['REPLY_HOSTNAME'].downcase
                return nil if email.sender_hostname.downcase == ENV['SMTP_DOMAIN'].downcase
            Severity: Minor
            Found in app/services/received_email_service.rb - About 1 day 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

            DiscussionModel has 59 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default class DiscussionModel extends BaseModel {
              static singular = 'discussion';
              static plural = 'discussions';
              static uniqueIndices = ['id', 'key'];
              static indices = ['groupId', 'authorId'];
            Severity: Major
            Found in vue/src/shared/models/discussion_model.js - About 1 day to fix

              GroupModel has 54 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export default class GroupModel extends BaseModel {
                static singular = 'group';
                static plural = 'groups';
                static uniqueIndices = ['id', 'key'];
                static indices = ['parentId'];
              Severity: Major
              Found in vue/src/shared/models/group_model.js - About 7 hrs to fix

                Class SnorlaxBase has 53 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class API::V1::SnorlaxBase < ActionController::Base
                  rescue_from(CanCan::AccessDenied)                    { |e| respond_with_standard_error e, 403 }
                  rescue_from(ActionController::UnpermittedParameters) { |e| respond_with_standard_error e, 400 }
                  rescue_from(ActionController::ParameterMissing)      { |e| respond_with_standard_error e, 400 }
                  rescue_from(ActiveRecord::RecordNotFound)            { |e| respond_with_standard_error e, 404 }
                Severity: Major
                Found in app/controllers/api/v1/snorlax_base.rb - About 7 hrs to fix

                  Class Poll has 52 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Poll < ApplicationRecord
                    extend  HasCustomFields
                    include CustomCounterCache::Model
                    include ReadableUnguessableUrls
                    include HasEvents
                  Severity: Major
                  Found in app/models/poll.rb - About 7 hrs to fix

                    PollModel has 52 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export default class PollModel extends BaseModel {
                      static singular = 'poll';
                      static plural = 'polls';
                      static uniqueIndices = ['id', 'key'];
                      static indices = ['discussionId', 'authorId', 'groupId'];
                    Severity: Major
                    Found in vue/src/shared/models/poll_model.js - About 7 hrs to fix

                      File thread_loader.js has 445 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import Records from '@/shared/services/records';
                      import { some, last, cloneDeep, max, uniq, compact, orderBy } from 'lodash-es';
                      import Vue from 'vue';
                      import RangeSet         from '@/shared/services/range_set';
                      import EventBus         from '@/shared/services/event_bus';
                      Severity: Minor
                      Found in vue/src/shared/loaders/thread_loader.js - About 6 hrs to fix

                        File poll.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        class Poll < ApplicationRecord
                          extend  HasCustomFields
                          include CustomCounterCache::Model
                          include ReadableUnguessableUrls
                          include HasEvents
                        Severity: Minor
                        Found in app/models/poll.rb - About 6 hrs to fix

                          Class Group has 47 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Group < ApplicationRecord
                            include HasTimeframe
                            include HasRichText
                            include CustomCounterCache::Model
                            include ReadableUnguessableUrls
                          Severity: Minor
                          Found in app/models/group.rb - About 6 hrs to fix

                            File group.rb has 404 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class Group < ApplicationRecord
                              include HasTimeframe
                              include HasRichText
                              include CustomCounterCache::Model
                              include ReadableUnguessableUrls
                            Severity: Minor
                            Found in app/models/group.rb - About 5 hrs to fix

                              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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language