Please use Rails.root.join('path', 'to')
instead. Open
format.html { render file: Rails.root.join('public/403'), layout: false, status: 403 }
- Read upRead up
- Exclude checks
This cop is used to identify usages of file path joining process
to use Rails.root.join
clause. It is used to add uniformity when
joining paths.
Example: EnforcedStyle: arguments (default)
# bad
Rails.root.join('app/models/goober')
File.join(Rails.root, 'app/models/goober')
"#{Rails.root}/app/models/goober"
# good
Rails.root.join('app', 'models', 'goober')
Example: EnforcedStyle: slashes
# bad
Rails.root.join('app', 'models', 'goober')
File.join(Rails.root, 'app/models/goober')
"#{Rails.root}/app/models/goober"
# good
Rails.root.join('app/models/goober')
Please use Rails.root.join('path', 'to')
instead. Open
format.html { render file: Rails.root.join('public/404'), layout: false, status: 404 }
- Read upRead up
- Exclude checks
This cop is used to identify usages of file path joining process
to use Rails.root.join
clause. It is used to add uniformity when
joining paths.
Example: EnforcedStyle: arguments (default)
# bad
Rails.root.join('app/models/goober')
File.join(Rails.root, 'app/models/goober')
"#{Rails.root}/app/models/goober"
# good
Rails.root.join('app', 'models', 'goober')
Example: EnforcedStyle: slashes
# bad
Rails.root.join('app', 'models', 'goober')
File.join(Rails.root, 'app/models/goober')
"#{Rails.root}/app/models/goober"
# good
Rails.root.join('app/models/goober')
Method parameter must be at least 3 characters long. Open
def user_not_authorized(e)
- Read upRead up
- Exclude checks
This cop checks method parameter names for how descriptive they are. It is highly configurable.
The MinNameLength
config option takes an integer. It represents
the minimum amount of characters the name must be. Its default is 3.
The AllowNamesEndingInNumbers
config option takes a boolean. When
set to false, this cop will register offenses for names ending with
numbers. Its default is false. The AllowedNames
config option
takes an array of whitelisted names that will never register an
offense. The ForbiddenNames
config option takes an array of
blacklisted names that will always register an offense.
Example:
# bad
def bar(varOne, varTwo)
varOne + varTwo
end
# With `AllowNamesEndingInNumbers` set to false
def foo(num1, num2)
num1 * num2
end
# With `MinArgNameLength` set to number greater than 1
def baz(a, b, c)
do_stuff(a, b, c)
end
# good
def bar(thud, fred)
thud + fred
end
def foo(speed, distance)
speed * distance
end
def baz(age_a, height_b, gender_c)
do_stuff(age_a, height_b, gender_c)
end