mose/rails-i18nterface

View on GitHub

Showing 52 of 52 total issues

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

      function success(resp) {
        var r = resp.responseText
        if (r) {
          switch (type) {
          case 'json':
Severity: Minor
Found in app/assets/javascripts/rails_i18nterface/ender.js - About 1 hr to fix

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

          case '|=':
            return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, '^' + clean(val) + '(-|$)', 1))
    Severity: Major
    Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/rails_i18nterface/ender.js on lines 1686..1687

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

    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

          case '~=':
            return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, '(?:^|\\s+)' + clean(val) + '(?:\\s+|$)', 1))
    Severity: Major
    Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/rails_i18nterface/ender.js on lines 1688..1689

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

    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

    Consider simplifying this complex logical expression.
    Open

          if (o) {
            o.type && (o.method = o.type) && delete o.type
            o.dataType && (o.type = o.dataType)
            o.jsonpCallback && (o.jsonpCallbackName = o.jsonpCallback) && delete o.jsonpCallback
            o.jsonp && (o.jsonpCallback = o.jsonp)
    Severity: Major
    Found in app/assets/javascripts/rails_i18nterface/ender.js - About 1 hr to fix

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

                  , height = de
                      ? Math.max(el.body.scrollHeight, el.body.offsetHeight, de.scrollWidth, de.offsetWidth, de.clientHeight)
                      : el.offsetHeight
      Severity: Major
      Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/rails_i18nterface/ender.js on lines 2836..2838

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

      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

                  , width = de
                      ? Math.max(el.body.scrollWidth, el.body.offsetWidth, de.scrollWidth, de.offsetWidth, de.clientWidth)
                      : el.offsetWidth
      Severity: Major
      Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/rails_i18nterface/ender.js on lines 2839..2841

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

      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 remove_blanks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def remove_blanks(hash)
            hash.each do |k, v|
              hash.delete k if !v || v == '' || v.is_a?(Proc)
              if v.is_a? Hash
                remove_blanks v
      Severity: Minor
      Found in lib/rails-i18nterface/utils.rb - About 55 mins 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

      Method populate_keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def populate_keys(root_dir, file)
            files = {}
            IO.read(file).scan(pattern2).each do |key, key2, count|
              key = key || key2
              path = relative_path(root_dir, file)
      Severity: Minor
      Found in lib/rails-i18nterface/sourcefiles.rb - About 55 mins 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

      Method deep_sort has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def deep_sort(object)
            if object.is_a?(Hash)
              res = {}
              object.each { |k, v| res[k] = deep_sort(v) }
              Hash[res.sort { |a, b| a[0].to_s <=> b[0].to_s }]
      Severity: Minor
      Found in lib/rails-i18nterface/utils.rb - About 55 mins 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 RegEntry has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                , RegEntry = function (element, type, handler, original, namespaces, args, root) {
      Severity: Major
      Found in app/assets/javascripts/rails_i18nterface/ender.js - About 50 mins to fix

        Method sort_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def sort_keys(order = 'key')
              if order == 'key'
                @all_keys.sort!
              else # text
                @all_keys.sort! do |key1, key2|
        Severity: Minor
        Found in lib/rails-i18nterface/keys.rb - About 45 mins 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 forAll has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                    , forAll = function (element, type, original, handler, root, fn) {
        Severity: Minor
        Found in app/assets/javascripts/rails_i18nterface/ender.js - About 45 mins to fix

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

                    'show '                                                          + // mouse buttons
                    'input invalid '                                                 + // form elements
                    'touchstart touchmove touchend touchcancel '                     + // touch
                    'gesturestart gesturechange gestureend '                         + // gesture
                    'textinput'                                                      + // TextEvent
          Severity: Minor
          Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 40 mins to fix
          app/assets/javascripts/rails_i18nterface/ender.js on lines 683..691

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

          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

                    'click dblclick mouseup mousedown contextmenu '                  + // mouse buttons
                    'mousewheel mousemultiwheel DOMMouseScroll '                     + // mouse wheel
                    'mouseover mouseout mousemove selectstart selectend '            + // mouse movement
                    'keydown keypress keyup '                                        + // keyboard
                    'orientationchange '                                             + // mobile
          Severity: Minor
          Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 40 mins to fix
          app/assets/javascripts/rails_i18nterface/ender.js on lines 695..703

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

          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

          Function once has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                , once = function (rm, element, type, fn, originalFn) {
          Severity: Minor
          Found in app/assets/javascripts/rails_i18nterface/ender.js - About 35 mins to fix

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

                  if (o.error) {
                    this._errorHandlers.push(function () {
                      o.error.apply(o, arguments)
                    })
                  }
            Severity: Minor
            Found in app/assets/javascripts/rails_i18nterface/ender.js and 2 other locations - About 35 mins to fix
            app/assets/javascripts/rails_i18nterface/ender.js on lines 339..343
            app/assets/javascripts/rails_i18nterface/ender.js on lines 351..355

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

            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

                  if (o.success) {
                    this._fulfillmentHandlers.push(function () {
                      o.success.apply(o, arguments)
                    })
                  }
            Severity: Minor
            Found in app/assets/javascripts/rails_i18nterface/ender.js and 2 other locations - About 35 mins to fix
            app/assets/javascripts/rails_i18nterface/ender.js on lines 345..349
            app/assets/javascripts/rails_i18nterface/ender.js on lines 351..355

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

            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

                  if (o.complete) {
                    this._completeHandlers.push(function () {
                      o.complete.apply(o, arguments)
                    })
                  }
            Severity: Minor
            Found in app/assets/javascripts/rails_i18nterface/ender.js and 2 other locations - About 35 mins to fix
            app/assets/javascripts/rails_i18nterface/ender.js on lines 339..343
            app/assets/javascripts/rails_i18nterface/ender.js on lines 345..349

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

            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

                        , left = bcr.left + scroll.x - Math.max(0, de && de.clientLeft, doc.body.clientLeft)
            Severity: Minor
            Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/rails_i18nterface/ender.js on lines 2802..2802

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

            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

                        , top = bcr.top + scroll.y - Math.max(0, de && de.clientTop, doc.body.clientTop)
            Severity: Minor
            Found in app/assets/javascripts/rails_i18nterface/ender.js and 1 other location - About 35 mins to fix
            app/assets/javascripts/rails_i18nterface/ender.js on lines 2803..2803

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

            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

            Severity
            Category
            Status
            Source
            Language