Line is too long. [113/80] Open
# @conninfo_hash - Extracted (actually removed!) PG database connection options, such as would be sent to:
- Exclude checks
Line is too long. [134/80] Open
@channel = hash_arg[:channel] || raise(ArgumentError, "[#{self.class}] :channel is required, but got #{args} and #{hash_arg}")
- Exclude checks
Line is too long. [114/80] Open
# Options must be the same named parameters that PG.connect() expects in its argument hash
- Exclude checks
Line is too long. [81/80] Open
# Null Object Pattern, just in case there are no options passed to initialize
- Exclude checks
Line is too long. [129/80] Open
# @super_signature - Arguments passed on to super, supports any type of argument signature / arity supported by Ruby itself.
- Exclude checks
Line is too long. [106/80] Open
# Future proof. Provide a way to send in any PG.connect() options not explicitly defined in KEYS
- Exclude checks
Extra empty line detected at class body end. Open
end
- Read upRead up
- Exclude checks
This cops 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: noemptylines (default)
# good
class Foo
def bar
# ...
end
end
Space missing after comma. Open
each_with_object({}) { |k,h| h.update(k => hash_arg[k]) }.
- Read upRead up
- Exclude checks
Checks for comma (,) not followed by some kind of space.
Example:
# bad
[1,2]
{ foo:bar,}
# good
[1, 2]
{ foo:bar, }
Line is too long. [112/80] Open
# The other parameter formats are accepted by PG::Connection.new are not supported here.
- Exclude checks
Line is too long. [141/80] Open
KEYS = [:host, :hostaddr, :port, :dbname, :user, :password, :connect_timeout, :options, :tty, :sslmode, :krbsrvname, :gsslib, :service]
- Exclude checks
Use %i
or %I
for an array of symbols. Open
KEYS = [:host, :hostaddr, :port, :dbname, :user, :password, :connect_timeout, :options, :tty, :sslmode, :krbsrvname, :gsslib, :service]
- Read upRead up
- Exclude checks
This cop can check for array literals made up of symbols that are not using the %i() syntax.
Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.
Configuration option: MinSize
If set, arrays with fewer elements than this value will not trigger the
cop. For example, a MinSize of
3` will not enforce a style on an array
of 2 or fewer elements.
Example: EnforcedStyle: percent (default)
# good
%i[foo bar baz]
# bad
[:foo, :bar, :baz]
Example: EnforcedStyle: brackets
# good
[:foo, :bar, :baz]
# bad
%i[foo bar baz]
Line is too long. [98/80] Open
# Named after, and structurally identical to, PG::Connection#conninfo_hash
- Exclude checks
Place the . on the next line, together with the method name. Open
@conninfo_hash = (hash_arg.keys & KEYS).
- Read upRead up
- Exclude checks
This cop checks the . position in multi-line method calls.
Example: EnforcedStyle: leading (default)
# bad
something.
mehod
# good
something
.method
Example: EnforcedStyle: trailing
# bad
something
.method
# good
something.
mehod
Freeze mutable objects assigned to constants. Open
KEYS = [:host, :hostaddr, :port, :dbname, :user, :password, :connect_timeout, :options, :tty, :sslmode, :krbsrvname, :gsslib, :service]
- Read upRead up
- Exclude checks
This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).
Example:
# bad
CONST = [1, 2, 3]
# good
CONST = [1, 2, 3].freeze
Extra empty line detected at class body beginning. Open
# see http://deveiate.org/code/pg/PG/Connection.html for key meanings
- Read upRead up
- Exclude checks
This cops 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: noemptylines (default)
# good
class Foo
def bar
# ...
end
end
Align merge
with (hash_arg.keys & KEYS).
on line 30. Open
merge(hash_arg[:conninfo_hash] || {})
- Read upRead up
- Exclude checks
This cop checks the indentation of the method name part in method calls that span more than one line.
Example: EnforcedStyle: aligned
# bad
while myvariable
.b
# do something
end
# good
while myvariable
.b
# do something
end
# good
Thing.a
.b
.c
Example: EnforcedStyle: indented
# good
while myvariable
.b
# do something
end
Example: EnforcedStyle: indentedrelativeto_receiver
# good
while myvariable
.a
.b
# do something
end
# good
myvariable = Thing
.a
.b
.c
Align each_with_object
with (hash_arg.keys & KEYS).
on line 30. Open
each_with_object({}) { |k,h| h.update(k => hash_arg[k]) }.
- Read upRead up
- Exclude checks
This cop checks the indentation of the method name part in method calls that span more than one line.
Example: EnforcedStyle: aligned
# bad
while myvariable
.b
# do something
end
# good
while myvariable
.b
# do something
end
# good
Thing.a
.b
.c
Example: EnforcedStyle: indented
# good
while myvariable
.b
# do something
end
Example: EnforcedStyle: indentedrelativeto_receiver
# good
while myvariable
.a
.b
# do something
end
# good
myvariable = Thing
.a
.b
.c