mose/rails-i18nterface

View on GitHub

Showing 33 of 52 total issues

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

    Method filter_by_key_pattern has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def filter_by_key_pattern(type, pattern)
          @all_keys.reject! do |key|
            if type == 'starts_with'
              if pattern == '.'
                key.match(/\./)
    Severity: Minor
    Found in lib/rails-i18nterface/keys.rb - About 35 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

    Avoid too many return statements within this function.
    Open

          if (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) return false
    Severity: Major
    Found in app/assets/javascripts/rails_i18nterface/ender.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return this
      Severity: Major
      Found in app/assets/javascripts/rails_i18nterface/ender.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return false
        Severity: Major
        Found in app/assets/javascripts/rails_i18nterface/ender.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return select(selector, root)
          Severity: Major
          Found in app/assets/javascripts/rails_i18nterface/ender.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    if (hasByClass && m[3]) return arrayify(root[byClass](m[3]))
            Severity: Major
            Found in app/assets/javascripts/rails_i18nterface/ender.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      if (m[2]) return arrayify(root[byTag](m[2]))
              Severity: Major
              Found in app/assets/javascripts/rails_i18nterface/ender.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return this
                Severity: Major
                Found in app/assets/javascripts/rails_i18nterface/ender.js - About 30 mins to fix

                  Method init_session has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def init_session
                        session[:from_locale] ||= I18n.default_locale
                        session[:to_locale] ||= I18n.default_locale
                        session[:per_page] ||= 50
                        session[:from_locale] = page_params.fetch(:from_locale) if page_params.has_key?(:from_locale)
                  Severity: Minor
                  Found in app/controllers/rails_i18nterface/translate_controller.rb - About 25 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_stringify_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def deep_stringify_keys(hash)
                        hash.reduce({}) do |result, (key, value)|
                          value = deep_stringify_keys(value) if value.is_a? Hash
                          result[(key.to_s rescue key) || key] = value
                          result
                  Severity: Minor
                  Found in lib/rails-i18nterface/utils.rb - About 25 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 apply_filters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def apply_filters(params)
                        params[:filter] ||= 'all'
                        remove_proc
                        filter_by_translated(params[:filter]) if params[:filter] != 'all'
                        filter_by_key_pattern(params[:key_type], params[:key_pattern]) unless params[:key_pattern].blank?
                  Severity: Minor
                  Found in lib/rails-i18nterface/keys.rb - About 25 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 simple_filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def simple_filter(labels, param_name = 'filter')
                        filter = []
                        labels.each do |label|
                          if label.to_s == params[param_name].to_s
                            filter << "<i>#{label}</i>"
                  Severity: Minor
                  Found in app/helpers/rails_i18nterface/translate_helper.rb - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language