diff --git a/lib/lint_roller/plugin.rb b/lib/lint_roller/plugin.rb index 6d614dc..603adee 100644 --- a/lib/lint_roller/plugin.rb +++ b/lib/lint_roller/plugin.rb @@ -18,5 +18,15 @@ def supported?(context) def rules(context) raise Error.new("Please implement `rules(context)` and return an instance of LintRoller::Rules") 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 cd0bb2c..ffa6ba3 100644 --- a/test/lib/plugin_test.rb +++ b/test/lib/plugin_test.rb @@ -58,6 +58,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,