Class has too many lines. [149/100] Open
class CheckOracleQuery < Sensu::Plugin::Check::CLI
option :username,
description: 'Oracle Username',
short: '-u USERNAME',
long: '--username USERNAME'
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for handle_connections_from_file is too high. [28.3/15] Open
def handle_connections_from_file
sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file],
config[:module])
::SensuPluginsOracle::Session.handle_multiple(sessions: sessions,
method: :query,
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [20/10] Open
def handle_connections_from_file
sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file],
config[:module])
::SensuPluginsOracle::Session.handle_multiple(sessions: sessions,
method: :query,
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for handle_connection is too high. [22.38/15] Open
def handle_connection
session = SensuPluginsOracle::Session.new(username: config[:username],
password: config[:password],
database: config[:database],
privilege: config[:privilege],
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Complex method CheckOracleQuery#handle_connections_from_file (45.6) Open
def handle_connections_from_file
sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file],
config[:module])
::SensuPluginsOracle::Session.handle_multiple(sessions: sessions,
method: :query,
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method has too many lines. [14/10] Open
def run
# handle OCI8 properties
::SensuPluginsOracle::Session.timeout_properties(config[:timeout])
if config[:version]
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for summary is too high. [19.75/15] Open
def summary(results, session_count)
# header
method = :ok
headers = ["Total: #{session_count}"]
messages = []
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [12/10] Open
def summary(results, session_count)
# header
method = :ok
headers = ["Total: #{session_count}"]
messages = []
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [11/10] Open
def handle_connection
session = SensuPluginsOracle::Session.new(username: config[:username],
password: config[:password],
database: config[:database],
privilege: config[:privilege],
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Complex method CheckOracleQuery#handle_connection (33.5) Open
def handle_connection
session = SensuPluginsOracle::Session.new(username: config[:username],
password: config[:password],
database: config[:database],
privilege: config[:privilege],
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method CheckOracleQuery#summary (28.2) Open
def summary(results, session_count)
# header
method = :ok
headers = ["Total: #{session_count}"]
messages = []
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Avoid rescuing without specifying an error class. Open
rescue => e
- Read upRead up
- Exclude checks
This cop checks for rescuing StandardError
. There are two supported
styles implicit
and explicit
. This cop will not register an offense
if any error other than StandardError
is specified.
Example: EnforcedStyle: implicit
# `implicit` will enforce using `rescue` instead of
# `rescue StandardError`.
# bad
begin
foo
rescue StandardError
bar
end
# good
begin
foo
rescue
bar
end
# good
begin
foo
rescue OtherError
bar
end
# good
begin
foo
rescue StandardError, SecurityError
bar
end
Example: EnforcedStyle: explicit (default)
# `explicit` will enforce using `rescue StandardError`
# instead of `rescue`.
# bad
begin
foo
rescue
bar
end
# good
begin
foo
rescue StandardError
bar
end
# good
begin
foo
rescue OtherError
bar
end
# good
begin
foo
rescue StandardError, SecurityError
bar
end
Incorrect indentation detected (column 9 instead of 2). Open
# required: true
- Read upRead up
- Exclude checks
This cops checks the indentation of comments.
Example:
# bad
# comment here
def method_name
end
# comment here
a = 'hello'
# yet another comment
if true
true
end
# good
# comment here
def method_name
end
# comment here
a = 'hello'
# yet another comment
if true
true
end
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
warning("You must supply: -q QUERY")
- Read upRead up
- Exclude checks
Checks if uses of quotes match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
"No special symbols"
"No string interpolation"
"Just text"
# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"
Example: EnforcedStyle: double_quotes
# bad
'Just some text'
'No special chars or interpolation'
# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"
Use %i
or %I
for an array of symbols. Open
[:warning, :critical].each do |type|
- 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]