Skip to content

Commit

Permalink
Move Rails/Output to rubocop.yml
Browse files Browse the repository at this point in the history
Move Rails/Output to rubocop.yml and enable it in the models files where it was disabled before.
  • Loading branch information
Ana06 committed Feb 15, 2017
1 parent fa267e9 commit 05787d6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 26 deletions.
8 changes: 8 additions & 0 deletions src/api/.rubocop.yml
Expand Up @@ -214,6 +214,14 @@ Rails:
# Use `find_by` instead `where.first` and `where.take`
Rails/FindBy:
Enabled: true

# Checks for the use of output calls like puts and print
Rails/Output:
Exclude:
- 'app/jobs/*'
- 'config/*'
- 'db/**/*'
- 'lib/**/*'

# Checks for the use of old-style attribute validation macros.
Rails/Validation:
Expand Down
18 changes: 0 additions & 18 deletions src/api/.rubocop_todo.yml
Expand Up @@ -205,24 +205,6 @@ Rails/NotNullColumn:
- 'db/migrate/20131027122410_add_primary_to_repository_architectures.rb'
- 'db/migrate/20131209103450_add_primary_to_groups_users.rb'

# Offense count: 38
# Configuration parameters: Include.
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
Rails/Output:
Exclude:
- 'app/jobs/create_job.rb'
- 'app/models/bs_request_action_group.rb'
- 'app/models/full_text_search.rb'
- 'app/models/update_notification_events.rb'
- 'config/deploy.rb'
- 'config/environment.rb'
- 'db/migrate/001_initial_database.rb'
- 'db/migrate/20130301100000_add_release_target_constraints.rb'
- 'db/migrate/20140908125426_convert_request_history.rb'
- 'db/seeds.rb'
- 'lib/opensuse/backend.rb'
- 'lib/workers/import_requests.rb'

# Offense count: 28
Rails/OutputSafety:
Exclude:
Expand Down
2 changes: 0 additions & 2 deletions src/api/app/jobs/consistency_check.rb
Expand Up @@ -45,7 +45,6 @@ def fix_project
end

def check_project(fix = nil)
# rubocop:disable Output
init
if ENV['project'].blank?
puts "Please specify the project with 'project=MyProject' on CLI"
Expand All @@ -61,7 +60,6 @@ def check_project(fix = nil)
end
@errors << package_existence_consistency_check(project, fix)
puts @errors unless @errors.blank?
# rubocop:enable Output
end

def project_meta_check(project, fix = nil)
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/bs_request_action_group.rb
Expand Up @@ -85,7 +85,7 @@ def render_xml_attributes(node)
end

def execute_accept(opts)
puts "changestate #{opts.inspect}"
logger.info "changestate #{opts.inspect}"
# TODO
end

Expand Down
6 changes: 3 additions & 3 deletions src/api/app/models/full_text_search.rb
Expand Up @@ -85,16 +85,16 @@ def index_and_start
interface.index
rescue => e
# Something failed, let's try again
puts "Indexing failed: #{e.message}"
puts "Retying indexing."
logger.info "Indexing failed: #{e.message}"
logger.info "Retying indexing."
interface.index
end
begin
interface.start
rescue RuntimeError => e
# Most likely, this means that searchd is already running.
# Nothing to worry about
puts "Handled exception: #{e.message}"
logger.info "Handled exception: #{e.message}"
end
end
true
Expand Down
3 changes: 2 additions & 1 deletion src/api/app/models/update_notification_events.rb
Expand Up @@ -31,7 +31,8 @@ def create_events
if Rails.env.test?
# make debug output useful in test suite, not just showing backtrace to HoptoaddNotifier
Rails.logger.error "ERROR: #{e.inspect}: #{e.backtrace}"
puts e.inspect, e.backtrace
logger.info e.inspect
logger.info o e.backtrace
end
HoptoadNotifier.notify(e, {failed_job: type.inspect})
return
Expand Down
1 change: 0 additions & 1 deletion src/api/db/checker.rb
@@ -1,4 +1,3 @@
# rubocop:disable Rails/Output
require 'colorize'

module DB
Expand Down

0 comments on commit 05787d6

Please sign in to comment.