thomis/sensu-plugins-oracle

View on GitHub

Showing 94 of 94 total issues

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'
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Complex method SensuPluginsOracle::Session::handle_multiple (60.4)
Open

    def self.handle_multiple(args = {})
      # queue with sesssion
      queue_sessions = Queue.new

      # feed the queue with sessions
Severity: Minor
Found in lib/sensu-plugins-oracle/session.rb by flog

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

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,
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

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,
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

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. [19/10]
Open

  def handle_connections_from_file
    sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file])
    ::SensuPluginsOracle::Session.handle_multiple(sessions: sessions,
                                                  method: :alive?,
                                                  config: config)
Severity: Minor
Found in bin/check-oracle-alive.rb by rubocop

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],
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

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,
Severity: Minor
Found in bin/check-oracle-query.rb by flog

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

Assignment Branch Condition size for handle_connections_from_file is too high. [21.4/15]
Open

  def handle_connections_from_file
    sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file])
    ::SensuPluginsOracle::Session.handle_multiple(sessions: sessions,
                                                  method: :alive?,
                                                  config: config)
Severity: Minor
Found in bin/check-oracle-alive.rb by rubocop

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 handle_multiple has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def self.handle_multiple(args = {})
      # queue with sesssion
      queue_sessions = Queue.new

      # feed the queue with sessions
Severity: Minor
Found in lib/sensu-plugins-oracle/session.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method has too many lines. [14/10]
Open

  def run
    # handle OCI8 properties
    ::SensuPluginsOracle::Session.timeout_properties(config[:timeout])

    if config[:version]
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

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 = []
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

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 = []
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

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],
Severity: Minor
Found in bin/check-oracle-query.rb by rubocop

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. [15.07/15]
Open

  def handle_connection
    session = SensuPluginsOracle::Session.new(username: config[:username],
                                              password: config[:password],
                                              database: config[:database],
                                              privilege: config[:privilege])
Severity: Minor
Found in bin/check-oracle-alive.rb by rubocop

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_connection (33.5)
Open

  def handle_connection
    session = SensuPluginsOracle::Session.new(username: config[:username],
                                              password: config[:password],
                                              database: config[:database],
                                              privilege: config[:privilege],
Severity: Minor
Found in bin/check-oracle-query.rb by flog

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 CheckOracleAlive#handle_connections_from_file (31.8)
Open

  def handle_connections_from_file
    sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file])
    ::SensuPluginsOracle::Session.handle_multiple(sessions: sessions,
                                                  method: :alive?,
                                                  config: config)
Severity: Minor
Found in bin/check-oracle-alive.rb by flog

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 = []
Severity: Minor
Found in bin/check-oracle-query.rb by flog

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

Block has too many lines. [29/25]
Open

Gem::Specification.new do |s|
  s.authors = ["Sensu-Plugins and contributors"]

  s.description = "This plugin provides native Oracle instrumentation."
  s.email = "<thomas.steiner@ikey.ch>"
Severity: Minor
Found in sensu-plugins-oracle.gemspec by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Method handle_connections_from_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_connections_from_file
    sessions = ::SensuPluginsOracle::Session.parse_from_file(config[:file])
    ::SensuPluginsOracle::Session.handle_multiple(sessions: sessions,
                                                  method: :alive?,
                                                  config: config)
Severity: Minor
Found in bin/check-oracle-alive.rb - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Complex method CheckOracleAlive#handle_connection (20.3)
Open

  def handle_connection
    session = SensuPluginsOracle::Session.new(username: config[:username],
                                              password: config[:password],
                                              database: config[:database],
                                              privilege: config[:privilege])
Severity: Minor
Found in bin/check-oracle-alive.rb by flog

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

Severity
Category
Status
Source
Language