A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rubocop/rubocop/issues/12360 below:

Predicate Methods Suffix · Issue #12360 · rubocop/rubocop · GitHub

Description

The names of predicate methods (methods that return a boolean value) should end in a question mark (i.e. Array#empty?). Methods that don't return a boolean, shouldn't end in a question mark.

https://rubystyle.guide/#bool-methods-qmark

Describe the solution you'd like
# bad
def my_method
  x == y
end

# good
def my_method?
  x == y
end
# bad
def my_method
  return false if x == y

  true
end

# good
def my_method?
  return false if x == y

  true
end
# good
def my_method
  return false if x == y

  nil
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4