loomio/loomio

View on GitHub

Showing 469 of 469 total issues

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

var GREEK_MAP = {
    'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', 'ζ':'z', 'η':'h', 'θ':'8',
    'ι':'i', 'κ':'k', 'λ':'l', 'μ':'m', 'ν':'n', 'ξ':'3', 'ο':'o', 'π':'p',
    'ρ':'r', 'σ':'s', 'τ':'t', 'υ':'y', 'φ':'f', 'χ':'x', 'ψ':'ps', 'ω':'w',
    'ά':'a', 'έ':'e', 'ί':'i', 'ό':'o', 'ύ':'y', 'ή':'h', 'ώ':'w', 'ς':'s',
Severity: Major
Found in vue/src/shared/helpers/parameterize.js and 1 other location - About 1 day to fix
vue/src/shared/helpers/emoji_table.js on lines 508..578

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

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

  'places': {
    'house': '🏠',
    'house_with_garden': '🏡',
    'school': '🏫',
    'office': '🏢',
Severity: Major
Found in vue/src/shared/helpers/emoji_table.js and 1 other location - About 1 day to fix
vue/src/shared/helpers/parameterize.js on lines 16..27

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

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

var LATIN_MAP = {
    'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç':
    'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
    'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö':
    'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
Severity: Major
Found in vue/src/shared/helpers/parameterize.js and 1 other location - About 1 day to fix
vue/src/shared/helpers/parameterize.js on lines 32..43

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

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

var RUSSIAN_MAP = {
    'а':'a', 'б':'b', 'в':'v', 'г':'g', 'д':'d', 'е':'e', 'ё':'yo', 'ж':'zh',
    'з':'z', 'и':'i', 'й':'j', 'к':'k', 'л':'l', 'м':'m', 'н':'n', 'о':'o',
    'п':'p', 'р':'r', 'с':'s', 'т':'t', 'у':'u', 'ф':'f', 'х':'h', 'ц':'c',
    'ч':'ch', 'ш':'sh', 'щ':'sh', 'ъ':'', 'ы':'y', 'ь':'', 'э':'e', 'ю':'yu',
Severity: Major
Found in vue/src/shared/helpers/parameterize.js and 1 other location - About 1 day to fix
vue/src/shared/helpers/parameterize.js on lines 2..12

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

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