Class: RSpec::Risky::RedundantPrintConfig

Inherits:
RuleConfig
  • Object
show all
Defined in:
lib/rspec/risky/configuration.rb,
sig/rspec/risky.rbs

Constant Summary collapse

VALID_CAPTURE =
%i[stdout stderr both].freeze

Constants inherited from RuleConfig

RSpec::Risky::RuleConfig::VALID_SEVERITIES

Instance Attribute Summary collapse

Attributes inherited from RuleConfig

#severity

Instance Method Summary collapse

Constructor Details

#initializeRedundantPrintConfig

Returns a new instance of RedundantPrintConfig.



76
77
78
79
80
81
82
83
84
# File 'lib/rspec/risky/configuration.rb', line 76

def initialize
  super
  @capture = :both
  @allow_warn = false
  @capture_loggers = false
  @logger_ignore_paths = ["log/test.log"]
  @passthrough = true
  @strict = false
end

Instance Attribute Details

#allow_warnBoolean

Returns the value of attribute allow_warn.

Returns:

  • (Boolean)


73
74
75
# File 'lib/rspec/risky/configuration.rb', line 73

def allow_warn
  @allow_warn
end

#captureSymbol

Returns the value of attribute capture.

Returns:

  • (Symbol)


74
75
76
# File 'lib/rspec/risky/configuration.rb', line 74

def capture
  @capture
end

#capture_loggersBoolean

Returns the value of attribute capture_loggers.

Returns:

  • (Boolean)


73
74
75
# File 'lib/rspec/risky/configuration.rb', line 73

def capture_loggers
  @capture_loggers
end

#logger_ignore_pathsArray[String]

Returns the value of attribute logger_ignore_paths.

Returns:

  • (Array[String])


73
74
75
# File 'lib/rspec/risky/configuration.rb', line 73

def logger_ignore_paths
  @logger_ignore_paths
end

#passthroughBoolean

Returns the value of attribute passthrough.

Returns:

  • (Boolean)


73
74
75
# File 'lib/rspec/risky/configuration.rb', line 73

def passthrough
  @passthrough
end

#strictBoolean

Returns the value of attribute strict.

Returns:

  • (Boolean)


73
74
75
# File 'lib/rspec/risky/configuration.rb', line 73

def strict
  @strict
end

Instance Method Details

#captures?(stream_name) ⇒ Boolean

Parameters:

  • (Symbol)

Returns:

  • (Boolean)


95
96
97
# File 'lib/rspec/risky/configuration.rb', line 95

def captures?(stream_name)
  capture == :both || capture == stream_name.to_sym
end

#captures_logger?(path) ⇒ Boolean

Parameters:

  • (String, nil)

Returns:

  • (Boolean)


99
100
101
# File 'lib/rspec/risky/configuration.rb', line 99

def captures_logger?(path)
  capture_loggers && !ignored_logger_path?(path)
end