concordia-publishing-house/errbit

View on GitHub

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

              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

                  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

                          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

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language