diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 997f0ee..93c559c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2015-10-12 09:35:47 +0200 using RuboCop version 0.34.2. +# on 2015-10-12 21:40:12 +0200 using RuboCop version 0.34.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -82,12 +82,6 @@ Rails/Validation: - 'app/models/problem.rb' - 'app/models/user.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -Style/AccessModifierIndentation: - Enabled: false - # Offense count: 8 # Cop supports --auto-correct. # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles. @@ -232,12 +226,11 @@ Style/EmptyLineBetweenDefs: - 'spec/decorators/issue_tracker_type_decorator_spec.rb' - 'spec/views/problems/show.html.haml_spec.rb' -# Offense count: 13 +# Offense count: 12 # Cop supports --auto-correct. Style/EmptyLines: Exclude: - 'app/controllers/api/v1/stats_controller.rb' - - 'app/controllers/application_controller.rb' - 'app/decorators/issue_tracker_field_decorator.rb' - 'app/models/app.rb' - 'app/models/problem.rb' @@ -246,20 +239,6 @@ Style/EmptyLines: - 'script/rspec-queue-mongoid.rb' - 'spec/acceptance/app_regenerate_api_key_spec.rb' -# Offense count: 9 -# Cop supports --auto-correct. -Style/EmptyLinesAroundAccessModifier: - Exclude: - - 'app/controllers/apps_controller.rb' - - 'app/controllers/comments_controller.rb' - - 'app/decorators/backtrace_line_decorator.rb' - - 'app/helpers/application_helper.rb' - - 'app/models/backtrace.rb' - - 'app/models/comment.rb' - - 'lib/hoptoad.rb' - - 'lib/hoptoad/v2.rb' - - 'lib/overrides/hoptoad_notifier/hoptoad_notifier.rb' - # Offense count: 28 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. @@ -377,13 +356,6 @@ Style/IndentationConsistency: - 'app/models/watcher.rb' - 'lib/hoptoad.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: Width. -Style/IndentationWidth: - Exclude: - - 'app/controllers/notices_controller.rb' - # Offense count: 6 # Cop supports --auto-correct. Style/Lambda: @@ -473,9 +445,15 @@ Style/Proc: - 'app/models/problem.rb' # Offense count: 2 -# Configuration parameters: SupportedStyles. +# Configuration parameters: EnforcedStyle, SupportedStyles. Style/RaiseArgs: - EnforcedStyle: compact + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantException: + Exclude: + - 'Gemfile' # Offense count: 13 # Cop supports --auto-correct. diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f4bc107..a4d7a2f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -17,8 +17,7 @@ class ApplicationController < ActionController::Base strategy StrongParametersWithEagerAttributesStrategy end -protected - + protected ## # Check if the current_user is admin or not and redirect to root url if not diff --git a/app/controllers/apps_controller.rb b/app/controllers/apps_controller.rb index d4f7e50..d2a251c 100644 --- a/app/controllers/apps_controller.rb +++ b/app/controllers/apps_controller.rb @@ -142,6 +142,7 @@ class AppsController < ApplicationController end private + def app_params params.require(:app).permit! end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 4572599..9333309 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -25,6 +25,7 @@ class CommentsController < ApplicationController end protected + def find_app @app = App.find(params[:app_id]) end diff --git a/app/controllers/notices_controller.rb b/app/controllers/notices_controller.rb index 164ed5f..16d90a1 100644 --- a/app/controllers/notices_controller.rb +++ b/app/controllers/notices_controller.rb @@ -15,7 +15,7 @@ class NoticesController < ApplicationController if report.should_keep? report.generate_notice! api_xml = report.notice.to_xml(:only => false, :methods => [:id]) do |xml| - xml.url locate_url(report.notice.id, :host => Errbit::Config.host) + xml.url locate_url(report.notice.id, :host => Errbit::Config.host) end render :xml => api_xml else diff --git a/app/decorators/backtrace_line_decorator.rb b/app/decorators/backtrace_line_decorator.rb index 998078e..c689e9a 100644 --- a/app/decorators/backtrace_line_decorator.rb +++ b/app/decorators/backtrace_line_decorator.rb @@ -50,6 +50,7 @@ class BacktraceLineDecorator < Draper::Decorator end private + def link_to_in_app_source_file(app, text) return unless in_app? if file_name =~ /\.js$/ diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index deefb00..317419c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -76,6 +76,7 @@ module ApplicationHelper end private + def total_from_tallies(tallies) tallies.values.inject(0) {|sum, n| sum + n} end diff --git a/app/models/backtrace.rb b/app/models/backtrace.rb index 560e0b4..e1d6805 100644 --- a/app/models/backtrace.rb +++ b/app/models/backtrace.rb @@ -23,6 +23,7 @@ class Backtrace end private + def generate_fingerprint self.fingerprint = self.class.generate_fingerprint(lines) end diff --git a/app/models/comment.rb b/app/models/comment.rb index d60c98e..a1cde17 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -29,6 +29,7 @@ class Comment end protected + def increase_counter_cache err.inc(comments_count: 1) end diff --git a/lib/hoptoad.rb b/lib/hoptoad.rb index 7e793ec..75e845d 100644 --- a/lib/hoptoad.rb +++ b/lib/hoptoad.rb @@ -14,6 +14,7 @@ module Hoptoad end private + def self.get_version_processor(version) case version when /2\.[01234]/; Hoptoad::V2 diff --git a/lib/hoptoad/v2.rb b/lib/hoptoad/v2.rb index 524d8cf..40bd937 100644 --- a/lib/hoptoad/v2.rb +++ b/lib/hoptoad/v2.rb @@ -6,7 +6,8 @@ module Hoptoad rekey(parsed))) end - private + private + def self.rekey(node) case node when Hash diff --git a/lib/overrides/hoptoad_notifier/hoptoad_notifier.rb b/lib/overrides/hoptoad_notifier/hoptoad_notifier.rb index 1db3ed4..bb18cc7 100644 --- a/lib/overrides/hoptoad_notifier/hoptoad_notifier.rb +++ b/lib/overrides/hoptoad_notifier/hoptoad_notifier.rb @@ -5,6 +5,7 @@ HoptoadNotifier.module_eval do class << self private + def send_notice(notice) # Log the error internally if we are not in a development environment. if configuration.public? -- libgit2 0.21.2