Showing 114 of 114 total issues
Line is too long. [112/80] Open
raise Error, "window x dimensions: [#{x_pos}, #{x_end}] exceeds monitor width [0..#{monitor_width - 1}]"
- Exclude checks
Use Range#cover?
instead of Range#include?
. Open
unless (0...monitor_width).include? x_pos
- Read upRead up
- Exclude checks
This cop identifies uses of Range#include?
, which iterates over each
item in a Range
to see if a specified item is there. In contrast,
Range#cover?
simply compares the target item with the beginning and
end points of the Range
. In a great majority of cases, this is what
is wanted.
Here is an example of a case where Range#cover?
may not provide the
desired result:
('a'..'z').cover?('yellow') # => true
Line is too long. [81/80] Open
opts.on('-v', '--verbose', 'Verbose mode') { |value| args.verbose = value }
- Exclude checks
Line is too long. [105/80] Open
raise Error, "Trying to write configuration on existing file #{conf_file}" if File.exist? conf_file
- Exclude checks
Line is too long. [97/80] Open
"#{LABELS[diff_index]}: expected=#{expected[diff_index]}, actual=#{actual[diff_index]}"
- Exclude checks
Line is too long. [85/80] Open
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
- Exclude checks
private
(on line 44) does not make singleton methods private. Use private_class_method
or private
inside a class << self
block instead. Open
def self.user_default_configuration_file
- Read upRead up
- Exclude checks
This cop checks for private
or protected
access modifiers which are
applied to a singleton method. These access modifiers do not make
singleton methods private/protected. private_class_method
can be
used for that.
Example:
# bad
class C
private
def self.method
puts 'hi'
end
end
Example:
# good
class C
def self.method
puts 'hi'
end
private_class_method :method
end
Example:
# good
class C
class << self
private
def method
puts 'hi'
end
end
end
Line is too long. [117/80] Open
MONITOR_LINE_REGEX = /^\s*+(?<id>[0-9]+):\s*\+(?<main>\*)?(?<name>[^\s]+)\s+#{RESOLUTION}\+#{OFFSET}.*$/.freeze
- Exclude checks
private
(on line 67) does not make singleton methods private. Use private_class_method
or private
inside a class << self
block instead. Open
def self.text_diff(actual, expected)
- Read upRead up
- Exclude checks
This cop checks for private
or protected
access modifiers which are
applied to a singleton method. These access modifiers do not make
singleton methods private/protected. private_class_method
can be
used for that.
Example:
# bad
class C
private
def self.method
puts 'hi'
end
end
Example:
# good
class C
def self.method
puts 'hi'
end
private_class_method :method
end
Example:
# good
class C
class << self
private
def method
puts 'hi'
end
end
end
Line is too long. [82/80] Open
display.action_window(window.id, :change_state, 'remove', *EXTENDED_HINTS)
- Exclude checks
Line is too long. [86/80] Open
value = AttributeNormalizer.new(key, @raw_definition[key], @monitor).normalize
- Exclude checks
Line is too long. [104/80] Open
def_delegators :@display, :windows, :close, :workspaces, :move_resize, :resize, :move, :to_workspace
- Exclude checks
Use =~
in places where the MatchData
returned by #match
will not be used. Open
raise OptionParser::InvalidOption, "'#{value}' is not an integer" unless value.match(/^[0-9]+$/)
- Read upRead up
- Exclude checks
This cop identifies the use of Regexp#match
or String#match
, which
returns #<MatchData>
/nil
. The return value of =~
is an integral
index/nil
and is more performant.
Example:
# bad
do_something if str.match(/regex/)
while regex.match('str')
do_something
end
# good
method(str =~ /regex/)
return value unless regex =~ 'str'
Line is too long. [105/80] Open
waiter = process_manager.execute_and_detach command, '/tmp/sapristi.stdout', '/tmp/sapristi.stderr'
- Exclude checks
Line is too long. [97/80] Open
@workspace = WindowManager.new.find_workspace_or_current definition_hash['Workspace']&.to_i
- Exclude checks
Line is too long. [111/80] Open
CSV.open(conf_file, 'wb', write_headers: true, headers: Definition::HEADERS, col_sep: SEPARATOR) do |csv|
- Exclude checks
Line is too long. [95/80] Open
raise Error, "y=#{y_pos} is outside of monitor height dimension=0..#{monitor_height - 1}"
- Exclude checks
Line is too long. [105/80] Open
raise Error, "window y size=#{window_height} less than #{MIN_Y_SIZE}" if window_height < MIN_Y_SIZE
- Exclude checks
Line is too long. [112/80] Open
::Sapristi.logger.info " Found window title=#{process_window.title} for process=#{process_window.pid}!"
- Exclude checks
Line is too long. [104/80] Open
guard :reek, all_on_start: false, run_all: false, cli: ['--format', 'html', '>', './tmp/reek.html'] do
- Exclude checks