From 5b2ae6885b787a2695494a16140c47f6f9175189 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 27 Sep 2016 19:11:56 +0200 Subject: [PATCH] Fix Lint/NestedMethodDefinition` in `dev-cmd/bottle.rb`. --- Library/.rubocop_todo.yml | 5 ----- Library/Homebrew/dev-cmd/bottle.rb | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml index 2162a7490e..b4ed8bb466 100644 --- a/Library/.rubocop_todo.yml +++ b/Library/.rubocop_todo.yml @@ -34,11 +34,6 @@ Lint/Loop: Exclude: - 'Homebrew/patch.rb' -# Offense count: 1 -Lint/NestedMethodDefinition: - Exclude: - - 'Homebrew/dev-cmd/bottle.rb' - # Offense count: 28 Lint/RescueException: Exclude: diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index b2aa3b2c50..83e40f25d2 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -44,9 +44,9 @@ module Homebrew def keg_contain?(string, keg, ignores) @put_string_exists_header, @put_filenames = nil - def print_filename(string, filename) + print_filename = lambda do |str, filename| unless @put_string_exists_header - opoo "String '#{string}' still exists in these files:" + opoo "String '#{str}' still exists in these files:" @put_string_exists_header = true end @@ -68,7 +68,7 @@ module Homebrew result ||= !linked_libraries.empty? if ARGV.verbose? - print_filename(string, file) unless linked_libraries.empty? + print_filename.call(string, file) unless linked_libraries.empty? linked_libraries.each do |lib| puts " #{Tty.gray}-->#{Tty.reset} links to #{lib}" end @@ -91,7 +91,7 @@ module Homebrew end next unless ARGV.verbose? && !text_matches.empty? - print_filename string, file + print_filename.call(string, file) text_matches.first(MAXIMUM_STRING_MATCHES).each do |match, offset| puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}" end