app/models/data_export.rb
Use tr
instead of gsub
. Open
Open
time = created_at.strftime("%r").gsub(":", "-")
- Read upRead up
- Exclude checks
This cop identifies places where gsub
can be replaced by
tr
or delete
.
Example:
# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')
# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')
Extra empty line detected at class body beginning. Open
Open
# A DataExport is a generated .zip of data from HackathonManager, such as a .zip of
- Read upRead up
- Exclude checks
This cop checks if empty lines around the bodies of classes match the configuration.
Example: EnforcedStyle: empty_lines
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: emptylinesexcept_namespace
# good
class Foo
class Bar
# ...
end
end
Example: EnforcedStyle: emptylinesspecial
# good
class Foo
def bar; end
end
Example: Enforcedstyle: beginning_only
# good
class Foo
def bar
# ...
end
end
Example: Enforcedstyle: ending_only
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: noemptylines (default)
# good
class Foo
def bar
# ...
end
end
Avoid comma after the last item of an array. Open
Open
"sponsor_dump_checked_in",
- Read upRead up
- Exclude checks
This cop checks for trailing comma in array literals.
Example: EnforcedStyleForMultiline: consistent_comma
# bad
a = [1, 2,]
# good
a = [
1, 2,
3,
]
# good
a = [
1,
2,
]
Example: EnforcedStyleForMultiline: comma
# bad
a = [1, 2,]
# good
a = [
1,
2,
]
Example: EnforcedStyleForMultiline: no_comma (default)
# bad
a = [1, 2,]
# good
a = [
1,
2
]