concordia-publishing-house/errbit

View on GitHub

Showing 64 of 64 total issues

File notifier.js has 730 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Airbrake JavaScript Notifier Bundle
(function(window, document, undefined) {
// Domain Public by Eric Wendelin http://eriwen.com/ (2008)
//                  Luke Smith http://lucassmith.name/ (2008)
//                  Loic Dachary <loic@dachary.org> (2008)
Severity: Major
Found in public/javascripts/notifier.js - About 1 day to fix

    File data_migration.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'mongo'
    
    include Mongo
    
    class ActiveRecord::Base
    Severity: Minor
    Found in lib/data_migration.rb - About 5 hrs to fix

      Class App has 34 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class App < ActiveRecord::Base
        include Comparable
      
        serialize :email_at_notices, Array
      
      
      Severity: Minor
      Found in app/models/app.rb - About 4 hrs to fix

        Class Worker has 33 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Worker
            # mapping should be a hash {:key_to => :key_from}
            # value of this hash can be an object and respond to :call, which returns value for new key
            USER_FIELDS_MAPPING = {
              :remote_id => lambda{|v| v["_id"].to_s},
        Severity: Minor
        Found in lib/data_migration.rb - About 4 hrs to fix

          Class Notice has 29 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Notice < ActiveRecord::Base
          
            serialize :server_environment, Hash
            serialize :request, Hash
            serialize :notifier, Hash
          Severity: Minor
          Found in app/models/notice.rb - About 3 hrs to fix

            Function _show has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _show: function(title, msg, value, type, callback) {
            
                        $.alerts._hide();
                        $.alerts._overlay('show');
            
            
            Severity: Major
            Found in app/assets/javascripts/jquery.alerts.js - About 3 hrs to fix

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

                $('input[type="checkbox"][data-hide-when-checked]').each(function(){
                  $(this).change(function(){
                    el = $($(this).data('hide-when-checked'));
                    $(this).attr('checked') ? el.hide() : el.show();
                  });
              Severity: Major
              Found in app/assets/javascripts/form.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/form.js on lines 102..107

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

              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

                $('input[type="checkbox"][data-show-when-checked]').each(function(){
                  $(this).change(function(){
                    el = $($(this).data('show-when-checked'));
                    $(this).attr('checked') ? el.show() : el.hide();
                  });
              Severity: Major
              Found in app/assets/javascripts/form.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/form.js on lines 96..101

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

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

                  def self.rekey(node)
                    case node
                    when Hash
                      if node.has_key?('var') && node.has_key?('key')
                        {normalize_key(node['key']) => rekey(node['var'])}
              Severity: Minor
              Found in lib/hoptoad/v2.rb - About 2 hrs 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

              Class Problem has 22 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Problem < ActiveRecord::Base
              
                serialize :messages, Hash
                serialize :user_agents, Hash
                serialize :hosts, Hash
              Severity: Minor
              Found in app/models/problem.rb - About 2 hrs to fix

                Function generateDataJSON has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        generateDataJSON: (function () {
                            /*
                             * Generate variables array for inputObj object.
                             * 
                             * e.g.
                Severity: Major
                Found in public/javascripts/notifier.js - About 2 hrs to fix

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

                                  $("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
                                      if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
                                      if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
                                  });
                  Severity: Major
                  Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/jquery.alerts.js on lines 137..140

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

                  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

                                  $("#popup_ok, #popup_cancel").keypress( function(e) {
                                      if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
                                      if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
                                  });
                  Severity: Major
                  Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/jquery.alerts.js on lines 154..157

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

                  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

                          alert: function(message, title, callback) {
                              if (! title) title = $.alerts.titles.alert;
                              $.alerts._show(title, message, null, 'alert', function(result) {
                                  if (callback) callback(result);
                              });
                  Severity: Major
                  Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jquery.alerts.js on lines 59..64

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

                  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

                          confirm: function(message, title, callback) {
                              if (! title) title = $.alerts.titles.confirm;
                              $.alerts._show(title, message, null, 'confirm', function(result) {
                                  if (callback) callback(result);
                              });
                  Severity: Major
                  Found in app/assets/javascripts/jquery.alerts.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/jquery.alerts.js on lines 52..57

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

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

                      handleRemote: function(element) {
                        var method, url, data, button,
                            crossDomain = element.data('cross-domain') || null,
                            dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType),
                            options;
                  Severity: Minor
                  Found in app/assets/javascripts/rails.js - About 1 hr to fix

                    Function notify has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            notify: (function () {
                                /*
                                 * Emit GET request via <iframe> element.
                                 * Data is transmited as a part of query string.
                                 */
                    Severity: Minor
                    Found in public/javascripts/notifier.js - About 1 hr to fix

                      Method create_issue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def create_issue(problem, reported_by = nil)
                            options = {
                                :username => username,
                                :password => password,
                                :site => base_url,
                      Severity: Minor
                      Found in app/models/issue_trackers/jira_tracker.rb - About 1 hr to fix

                        Function generateBacktrace has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                generateBacktrace: function (error) {
                                    var backtrace = [],
                                        file,
                                        i,
                                        matches,
                        Severity: Minor
                        Found in public/javascripts/notifier.js - About 1 hr to fix

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

                                          result.push(fnName + '()@' + 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 292..292

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language