Class: Packwerk::Formatters::DefaultOffensesFormatter
- Inherits:
-
Object
- Object
- Packwerk::Formatters::DefaultOffensesFormatter
- Includes:
- OffensesFormatter
- Defined in:
- lib/packwerk/formatters/default_offenses_formatter.rb
Constant Summary collapse
- IDENTIFIER =
: String
"default"
Instance Method Summary collapse
-
#identifier ⇒ Object
: -> String.
-
#show_offenses(offenses) ⇒ Object
: (Array offenses) -> String.
-
#show_stale_violations(offense_collection, file_set) ⇒ Object
: (OffenseCollection offense_collection, Set file_set) -> String.
-
#show_strict_mode_violations(strict_mode_violations) ⇒ Object
: (Array strict_mode_violations) -> String.
Methods included from OffensesFormatter
Instance Method Details
#identifier ⇒ Object
: -> String
34 35 36 |
# File 'lib/packwerk/formatters/default_offenses_formatter.rb', line 34 def identifier IDENTIFIER end |
#show_offenses(offenses) ⇒ Object
: (Array offenses) -> String
13 14 15 16 17 18 19 20 |
# File 'lib/packwerk/formatters/default_offenses_formatter.rb', line 13 def show_offenses(offenses) return "No offenses detected" if offenses.empty? <<~EOS #{offenses_list(offenses)} #{offenses_summary(offenses)} EOS end |
#show_stale_violations(offense_collection, file_set) ⇒ Object
: (OffenseCollection offense_collection, Set file_set) -> String
24 25 26 27 28 29 30 |
# File 'lib/packwerk/formatters/default_offenses_formatter.rb', line 24 def show_stale_violations(offense_collection, file_set) if offense_collection.stale_violations?(file_set) "There were stale violations found, please run `packwerk update-todo`" else "No stale violations detected" end end |
#show_strict_mode_violations(strict_mode_violations) ⇒ Object
: (Array strict_mode_violations) -> String
40 41 42 43 44 45 46 |
# File 'lib/packwerk/formatters/default_offenses_formatter.rb', line 40 def show_strict_mode_violations(strict_mode_violations) if strict_mode_violations.any? strict_mode_violations.compact.map { |offense| format_strict_mode_violation(offense) }.join("\n") else "" end end |