concordia-publishing-house/errbit

View on GitHub

Showing 64 of 64 total issues

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

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

                $("#popup_cancel").click( function() {
                    $.alerts._hide();
                    if( callback ) callback(false);
                });
Severity: Minor
Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 30 mins to fix
app/assets/javascripts/jquery.alerts.js on lines 128..131

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

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

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

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

                            $("#popup_ok").click( function() {
                                $.alerts._hide();
                                if( callback ) callback(true);
                            });
            Severity: Minor
            Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 30 mins to fix
            app/assets/javascripts/jquery.alerts.js on lines 132..135

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

            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

            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

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

                      def copy_notification_service(app, old_app)
                        return unless old_app["notification_service"]
                        notification_service = app.build_notification_service
                        copy_attributes_with_mapping(NOTIFICATION_SERVICE_FIELDS_MAPPING, old_app["notification_service"], notification_service)
                        app.notification_service.type = normalize_notification_service_classname(old_app["notification_service"]["_type"])
                Severity: Minor
                Found in lib/data_migration.rb and 1 other location - About 25 mins to fix
                lib/data_migration.rb on lines 405..412

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

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

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

                      def copy_issue_tracker(app, old_app)
                        return unless old_app["issue_tracker"]
                        issue_tracker = app.build_issue_tracker
                        copy_attributes_with_mapping(ISSUE_TRACKER_FIELDS_MAPPING, old_app["issue_tracker"], issue_tracker)
                        app.issue_tracker.type = normalize_issue_tracker_classname(old_app["issue_tracker"]["_type"])
                Severity: Minor
                Found in lib/data_migration.rb and 1 other location - About 25 mins to fix
                lib/data_migration.rb on lines 415..422

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

                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

                    respond_to do |format|
                      format.html { render :json => Yajl.dump(stats) } # render JSON if no extension specified on path
                      format.json { render :json => Yajl.dump(stats) }
                      format.xml  { render :xml  => stats }
                Severity: Minor
                Found in app/controllers/api/v1/stats_controller.rb and 2 other locations - About 25 mins to fix
                app/controllers/api/v1/notices_controller.rb on lines 16..19
                app/controllers/api/v1/problems_controller.rb on lines 15..18

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

                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

                    respond_to do |format|
                      format.html { render :json => Yajl.dump(results) } # render JSON if no extension specified on path
                      format.json { render :json => Yajl.dump(results) }
                      format.xml  { render :xml  => results }
                Severity: Minor
                Found in app/controllers/api/v1/problems_controller.rb and 2 other locations - About 25 mins to fix
                app/controllers/api/v1/notices_controller.rb on lines 16..19
                app/controllers/api/v1/stats_controller.rb on lines 19..22

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

                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

                    respond_to do |format|
                      format.html { render :json => Yajl.dump(results) } # render JSON if no extension specified on path
                      format.json { render :json => Yajl.dump(results) }
                      format.xml  { render :xml  => results }
                Severity: Minor
                Found in app/controllers/api/v1/notices_controller.rb and 2 other locations - About 25 mins to fix
                app/controllers/api/v1/problems_controller.rb on lines 15..18
                app/controllers/api/v1/stats_controller.rb on lines 19..22

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

                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