concordia-publishing-house/errbit

View on GitHub

Showing 64 of 64 total issues

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

                result.push(ANON + '()@' + match[2] + ':' + match[1] + ' -- ' + lines[i + 1].replace(/^\s+/, ''));
Severity: Major
Found in public/javascripts/notifier.js and 1 other location - About 1 hr to fix
public/javascripts/notifier.js on lines 275..275

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

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 generatePublicAPI has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        generatePublicAPI: (function () {
            function _generateSetter (variable, namespace, configObj) {
                return function (value) {
                    configObj[namespace][variable] = value;
                };
Severity: Minor
Found in public/javascripts/notifier.js - About 1 hr to fix

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

      def default_values
        if self.new_record?
          self.user_agents ||= Hash.new
          self.messages ||= Hash.new
          self.hosts ||= Hash.new
    Severity: Minor
    Found in app/models/problem.rb - About 1 hr 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 stringifyArguments has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        stringifyArguments: function(args) {
            var result = [];
            var slice = Array.prototype.slice;
            for (var i = 0; i < args.length; ++i) {
                var arg = args[i];
    Severity: Minor
    Found in public/javascripts/notifier.js - About 1 hr to fix

      Function findFunctionName has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          findFunctionName: function(source, lineNo) {
              // FIXME findFunctionName fails for compressed source
              // (more than one function on the same line)
              // function {name}({args}) m[1]=name m[2]=args
              var reFunctionDeclaration = /function\s+([^(]*?)\s*\(([^)]*)\)/;
      Severity: Minor
      Found in public/javascripts/notifier.js - About 1 hr to fix

        Function mode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            mode: function(e) {
                if (e['arguments'] && e.stack) {
                    return 'chrome';
                } else if (e.stack && e.sourceURL) {
                    return 'safari';
        Severity: Minor
        Found in public/javascripts/notifier.js - About 1 hr to fix

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

            def copy_attributes_from(app_id)
              if copy_app = App.find(app_id)
                # Copy fields
                (copy_app.attribute_names - %w(id name created_at updated_at)).each do |k|
                  self.send("#{k}=", copy_app.send(k))
          Severity: Minor
          Found in app/models/app.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

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

            $(rails.formSubmitSelector).live('ajax:beforeSend.rails', function(event) {
              if (this == event.target) rails.disableFormElements($(this));
            });
          Severity: Minor
          Found in app/assets/javascripts/rails.js and 1 other location - About 55 mins to fix
          app/assets/javascripts/rails.js on lines 401..403

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

          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

            $(rails.formSubmitSelector).live('ajax:complete.rails', function(event) {
              if (this == event.target) rails.enableFormElements($(this));
            });
          Severity: Minor
          Found in app/assets/javascripts/rails.js and 1 other location - About 55 mins to fix
          app/assets/javascripts/rails.js on lines 397..399

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

          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 top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
          Severity: Minor
          Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 55 mins to fix
          app/assets/javascripts/jquery.alerts.js on lines 202..202

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

          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 left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
          Severity: Minor
          Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 55 mins to fix
          app/assets/javascripts/jquery.alerts.js on lines 201..201

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

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

            def tracker
              return @tracker if @tracker
          
              # Create an issue on GitHub using user's github token
              if tracker_name == 'user_github'
          Severity: Minor
          Found in app/interactors/issue_creation.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

          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

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

                } else {
                  $('#user_password').parent().attr('class', '')
                  $('#user_password_confirmation').parent().attr('class', '')
                }
          Severity: Minor
          Found in app/assets/javascripts/errbit.js and 1 other location - About 40 mins to fix
          app/assets/javascripts/errbit.js on lines 99..102

          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

                if($(input).val() == "") {
                  $('#user_password').parent().attr('class', 'required')
                  $('#user_password_confirmation').parent().attr('class', 'required')
                } else {
          Severity: Minor
          Found in app/assets/javascripts/errbit.js and 1 other location - About 40 mins to fix
          app/assets/javascripts/errbit.js on lines 102..105

          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

              def initialize_subclassed_notification_service
                # set the app's notification service
                if params[:app][:notification_service_attributes] && notification_type = params[:app][:notification_service_attributes][:type]
                  if NotificationService.subclasses.map(&:name).concat(["NotificationService"]).include?(notification_type)
                    app.notification_service = notification_type.constantize.new(params[:app][:notification_service_attributes])
          Severity: Minor
          Found in app/controllers/apps_controller.rb and 1 other location - About 40 mins to fix
          app/controllers/apps_controller.rb on lines 90..96

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

          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

              def initialize_subclassed_issue_tracker
                # set the app's issue tracker
                if params[:app][:issue_tracker_attributes] && tracker_type = params[:app][:issue_tracker_attributes][:type]
                  if IssueTracker.subclasses.map(&:name).concat(["IssueTracker"]).include?(tracker_type)
                    app.issue_tracker = tracker_type.constantize.new(params[:app][:issue_tracker_attributes])
          Severity: Minor
          Found in app/controllers/apps_controller.rb and 1 other location - About 40 mins to fix
          app/controllers/apps_controller.rb on lines 99..105

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

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

              Severity
              Category
              Status
              Source
              Language