diff --git a/lib/lint_roller/plugin.rb b/lib/lint_roller/plugin.rb index 7893319..a24cf91 100644 --- a/lib/lint_roller/plugin.rb +++ b/lib/lint_roller/plugin.rb @@ -24,5 +24,15 @@ def rules(context) def <=>(other) about.name <=> other.about.name end + + def to_s + if about.name && about.version + "#{about.name} (#{about.version})" + elsif about.name + about.name + else + inspect + end + end end end diff --git a/test/lib/plugin_test.rb b/test/lib/plugin_test.rb index b2fd78b..633f81c 100644 --- a/test/lib/plugin_test.rb +++ b/test/lib/plugin_test.rb @@ -87,6 +87,8 @@ def test_sample_roller assert sample_roller.supported?(Context.new(runner: :standard)) refute sample_roller.supported?(Context.new(runner: :rufo)) + assert_equal sample_roller.to_s, "sample-roller (1.2.3)" + assert_equal Rules.new( type: :path, config_format: :rubocop,