loomio/loomio

View on GitHub

Showing 175 of 175 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

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

export default class Align extends Mark {
  get name () {
    return 'align'
  }

Severity: Major
Found in vue/src/shared/tiptap_extentions/align.js and 2 other locations - About 1 day to fix
vue/src/shared/tiptap_extentions/back_color.js on lines 5..43
vue/src/shared/tiptap_extentions/fore_color.js on lines 5..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 243.

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

export default class BackColor extends Mark {
  get name () {
    return 'backColor'
  }

Severity: Major
Found in vue/src/shared/tiptap_extentions/back_color.js and 2 other locations - About 1 day to fix
vue/src/shared/tiptap_extentions/align.js on lines 5..43
vue/src/shared/tiptap_extentions/fore_color.js on lines 5..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 243.

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

export default class ForeColor extends Mark {
  get name () {
    return 'foreColor'
  }

Severity: Major
Found in vue/src/shared/tiptap_extentions/fore_color.js and 2 other locations - About 1 day to fix
vue/src/shared/tiptap_extentions/align.js on lines 5..43
vue/src/shared/tiptap_extentions/back_color.js on lines 5..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 243.

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

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

    function findActiveMarkAttribute (state, name) {
      const { schema, selection, tr } = state
      const markType = schema.marks[name]
    
      if (!markType) {
    Severity: Major
    Found in vue/src/shared/tiptap_extentions/utils/mark.js and 1 other location - About 1 day to fix
    vue/src/shared/tiptap_extentions/utils/mark.js on lines 66..99

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

    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

    function findActiveFontFamily (state) {
      const { schema, selection, tr } = state
      const markType = schema.marks.fontFamily
    
      if (!markType) {
    Severity: Major
    Found in vue/src/shared/tiptap_extentions/utils/mark.js and 1 other location - About 1 day to fix
    vue/src/shared/tiptap_extentions/utils/mark.js on lines 101..134

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

    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 Poll has 53 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

      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 Group has 37 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 4 hrs to fix

          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

            File poll.rb has 349 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 4 hrs to fix

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

                def initialize(user)
                  super(user)
              
                  can :add_options, ::Poll do |poll|
                    user_is_author_of?(poll) || (user.can?(:vote_in, poll) && poll.voter_can_add_options)
              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

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

                commands ({ type }) {
                  return attrs => (state, dispatch) => {
                    const { selection } = state;
                    const position = selection.$cursor
                      ? selection.$cursor.pos
              Severity: Major
              Found in vue/src/components/lmo_textarea/iframe.js and 1 other location - About 4 hrs to fix
              vue/src/shared/tiptap_extentions/image.js on lines 128..136

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

              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

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

                commands({ type }) {
                  return attrs => (state, dispatch) => {
                    const { selection } = state
                    const position = selection.$cursor ? selection.$cursor.pos : selection.$to.pos
                    const node = type.create(attrs)
              Severity: Major
              Found in vue/src/shared/tiptap_extentions/image.js and 1 other location - About 4 hrs to fix
              vue/src/components/lmo_textarea/iframe.js on lines 39..49

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

              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 User has 32 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

                Function setAlignment has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function setAlignment (type, attrs = {}) {
                  return (state, dispatch) => {
                    const {
                      doc,
                      selection,
                Severity: Major
                Found in vue/src/shared/tiptap_extentions/utils/alignment.js - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language