Class: PgCanary::Rules::Detection
- Inherits:
-
Struct
- Object
- Struct
- PgCanary::Rules::Detection
- Defined in:
- lib/pg_canary/rules/detection.rb
Overview
What a rule's #check returns: one anti-pattern finding — which rule fired, on which query, which table/columns are involved, why it is a problem, and how to fix it.
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#fingerprint ⇒ Object
Returns the value of attribute fingerprint.
-
#location ⇒ Object
Returns the value of attribute location.
-
#message ⇒ Object
Returns the value of attribute message.
-
#rule_name ⇒ Object
Returns the value of attribute rule_name.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#sql ⇒ Object
Returns the value of attribute sql.
-
#suggestion ⇒ Object
Returns the value of attribute suggestion.
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def columns @columns end |
#fingerprint ⇒ Object
Returns the value of attribute fingerprint
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def fingerprint @fingerprint end |
#location ⇒ Object
Returns the value of attribute location
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def location @location end |
#message ⇒ Object
Returns the value of attribute message
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def @message end |
#rule_name ⇒ Object
Returns the value of attribute rule_name
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def rule_name @rule_name end |
#severity ⇒ Object
Returns the value of attribute severity
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def severity @severity end |
#sql ⇒ Object
Returns the value of attribute sql
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def sql @sql end |
#suggestion ⇒ Object
Returns the value of attribute suggestion
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def suggestion @suggestion end |
#table ⇒ Object
Returns the value of attribute table
10 11 12 |
# File 'lib/pg_canary/rules/detection.rb', line 10 def table @table end |
Instance Method Details
#truncated_sql ⇒ Object
15 16 17 18 |
# File 'lib/pg_canary/rules/detection.rb', line 15 def truncated_sql squashed = sql.to_s.strip.gsub(/\s+/, " ") squashed.length > MAX_SQL_LENGTH ? "#{squashed[0, MAX_SQL_LENGTH]}…" : squashed end |