Disable cop for #set_cpu_flags, #set_cpu_cflags

In `extend/ENV/std.rb`, the methods `set_cpu_flags` and
`set_cpu_cflags` have been violating the `Naming/AccessorMethodName`
cop.

A recent modification in #7e13b3749 woke up the cop. That means we’re
likely dealing with legacy code here, predating the introduction of
RuboCop into Homebrew.

This commit disables the cop for either method. I believe refactoring
wouldn’t currently be worth the effort, especially given that
`#set_cpu_cflags` is mostly called without arguments.
This commit is contained in:
Claudia 2019-01-08 08:13:25 +01:00
parent 464b41eb52
commit a72af2c8a6
No known key found for this signature in database
GPG Key ID: 246AC3C0F10BE51F

View File

@ -198,7 +198,7 @@ module Stdenv
# Sets architecture-specific flags for every environment variable
# given in the list `flags`.
# @private
def set_cpu_flags(flags, map = Hardware::CPU.optimization_flags)
def set_cpu_flags(flags, map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName
cflags =~ /(-Xarch_#{Hardware::CPU.arch_32_bit} )-march=/
xarch = Regexp.last_match(1).to_s
remove flags, /(-Xarch_#{Hardware::CPU.arch_32_bit} )?-march=\S*/
@ -213,7 +213,7 @@ module Stdenv
def x11; end
# @private
def set_cpu_cflags(map = Hardware::CPU.optimization_flags)
def set_cpu_cflags(map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName
set_cpu_flags CC_FLAG_VARS, map
end