concordia-publishing-house/errbit

View on GitHub

Showing 37 of 64 total issues

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

  def active_if_here(matches)
    current_controller = controller.controller_name.to_sym
    current_action     = controller.action_name.to_sym

    sections =  case matches
Severity: Minor
Found in app/helpers/navigation_helper.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 onerror has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    window.onerror = function (message, file, line, code, error) {
Severity: Minor
Found in public/javascripts/notifier.js - About 35 mins to fix

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

            _show: function(title, msg, value, type, callback) {
    Severity: Minor
    Found in app/assets/javascripts/jquery.alerts.js - About 35 mins to fix

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

        def pretty_hash(hash, nesting = 0)
          tab_size = 2
          nesting += 1
      
          pretty  = "{"
      Severity: Minor
      Found in app/helpers/hash_helper.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

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

        def github
          github_login = env["omniauth.auth"].extra.raw_info.login
          github_token = env["omniauth.auth"].credentials.token
          github_user  = User.where(:github_login => github_login).first
      
      
      Severity: Minor
      Found in app/controllers/users/omniauth_callbacks_controller.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

                      return 'opera9'; // use e.message
      Severity: Major
      Found in public/javascripts/notifier.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return 'opera10b'; // use e.stacktrace, format differs from 'opera10a'
        Severity: Major
        Found in public/javascripts/notifier.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return 'opera10a'; // use e.stacktrace
          Severity: Major
          Found in public/javascripts/notifier.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return 'other';
            Severity: Major
            Found in public/javascripts/notifier.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return 'opera11'; // use e.stacktrace, format differs from 'opera10a', 'opera10b'
              Severity: Major
              Found in public/javascripts/notifier.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return 'chrome';
                Severity: Major
                Found in public/javascripts/notifier.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return 'firefox';
                  Severity: Major
                  Found in public/javascripts/notifier.js - About 30 mins to fix

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

                      def default_values
                        if self.new_record?
                          self.server_environment ||= Hash.new
                          self.request ||= Hash.new
                          self.notifier ||= Hash.new
                    Severity: Minor
                    Found in app/models/notice.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 plug_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def plug_params app
                          app.watchers.build if app.watchers.none?
                          app.issue_tracker = IssueTracker.new unless app.issue_tracker_configured?
                          app.notification_service = NotificationService.new unless app.notification_service_configured?
                          app.copy_attributes_from(params[:copy_attributes_from]) if params[:copy_attributes_from]
                    Severity: Minor
                    Found in app/controllers/apps_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 copy_attributes_with_mapping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def copy_attributes_with_mapping(map_hash, copy_from, copy_to)
                            map_hash.each do |to_key, from_key|
                              if from_key.respond_to? :call
                                copy_to.send("#{to_key}=", from_key.call(copy_from))
                              else
                    Severity: Minor
                    Found in lib/data_migration.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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def url
                          acc_url = account.start_with?('http') ? account : "http://#{account}"
                          acc_url = acc_url.gsub(/\/$/, '')
                          URI.parse("#{acc_url}/projects/#{project_id}").to_s
                        rescue URI::InvalidURIError
                    Severity: Minor
                    Found in app/models/issue_trackers/redmine_tracker.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 url_to_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def url_to_file(file_path, line_number = nil)
                          # alt_project_id let's users specify a different project for tickets / app files.
                          project = self.alt_project_id.present? ? self.alt_project_id : self.project_id
                          url = "#{self.account.gsub(/\/$/, '')}/projects/#{project}/repository/revisions/#{app.repository_branch}/changes/#{file_path.sub(/\[PROJECT_ROOT\]/, '').sub(/^\//,'')}"
                          line_number ? url << "#L#{line_number}" : url
                    Severity: Minor
                    Found in app/models/issue_trackers/redmine_tracker.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