lint_roller 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 247433b599df47c6817d7afaafd5da089706ebcae854383d12e96c6c9551113a
4
- data.tar.gz: 1f6d77951ed64e2f52d5145fed81b8eb0d5ad1befa353e20b3ce65c33d233e50
3
+ metadata.gz: f2fd0d1d1ea02f68478b1c2494f5653b2bb8eca764d86d1b3879188fa80cf5ec
4
+ data.tar.gz: 3e2b04be9ea384a8e2a76a370bd41c9265a951f3b49af8377b9108276c20e67d
5
5
  SHA512:
6
- metadata.gz: d826ec3722b1d85f1f718519ea5958e89dc22878f02e9e6f3b4d601a2a1e8d159be91a0c4f7dc1de0fb5245add220d4d656f6547b6d24f33d6dc84ae77347e09
7
- data.tar.gz: d86e1f61d4eb7702014e5509d83a424fa74fb20efcb0209f775213313db90ee4e5cf2446a58038b002efd6532bcc9059fd72cb03dc7ef96f11b84bcc28f2b257
6
+ metadata.gz: abdb2314cc0b073c2005721ceec4c64587f604f2e1fea24e235a4593b9ba407f3ac73b0540df978ab514365ecebae2a0c06a312961b5eeafa28475718ec1a5f9
7
+ data.tar.gz: 6759710ae4e8ebe8aae2d57626899a3461b39fc6ffd31255d5dc8855b61998cacadedc3999347b1dcb48139c1e606b1e6450716a5d5de49d96b7faa404e5ca2d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0]
4
+
5
+ - Add `LintRoller::Support` module of classes designed to make it a little
6
+ easier to author plugins. `MergesUpstreamMetadata#merge` will allow a minimal
7
+ YAML config (say, `standard-sorbet`'s, which only contains `Enabled` values for
8
+ each rule) to merge in any other defaults from a source YAML (e.g.
9
+ `rubocop-sorbet`'s which includes `Description`, `VersionAdded`, and so on).
10
+ This way that metadata is neither absent at runtime nor duplicated in a standard
11
+ plugin that mirrors a rubocop extension
12
+
3
13
  ## [1.0.0]
4
14
 
5
15
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lint_roller (1.0.0)
4
+ lint_roller (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -45,6 +45,7 @@ GEM
45
45
 
46
46
  PLATFORMS
47
47
  arm64-darwin-22
48
+ x86_64-linux
48
49
 
49
50
  DEPENDENCIES
50
51
  lint_roller!
data/README.md CHANGED
@@ -19,7 +19,7 @@ this example plugin for banana-related static analysis:
19
19
 
20
20
  ```ruby
21
21
  module BananaRoller
22
- class Plugin
22
+ class Plugin < LintRoller::Plugin
23
23
  # `config' is a Hash of options passed to the plugin by the user
24
24
  def initialize(config = {})
25
25
  @alternative = config["alternative"] ||= "chocolate"
@@ -36,11 +36,7 @@ module BananaRoller
36
36
 
37
37
  # `context' is an instance of LintRoller::Context provided by the runner
38
38
  def supported?(context)
39
- if context.engine == :rubocop
40
- true
41
- else
42
- false
43
- end
39
+ context.engine == :rubocop
44
40
  end
45
41
 
46
42
  # `context' is an instance of LintRoller::Context provided by the runner
@@ -56,14 +52,16 @@ end
56
52
  ```
57
53
 
58
54
  And that's pretty much it. Just a declarative way to identify your plugin,
59
- detect whether it supports the given context (e.g. the current `runner` and
60
- `engine` and their respective `_version`s), and then provides your custom
61
- configuration as a [LintRoller::Rules](lib/lint_roller/rules.rb) object.
55
+ detect whether it supports the given
56
+ [LintRoller::Context](/lib/lint_roller_context.rb) (e.g. the current `runner`
57
+ and `engine` and their respective `_version`s), for which the plugin will
58
+ ultimately its configuration as a [LintRoller::Rules](/lib/lint_roller/rules.rb)
59
+ object.
62
60
 
63
61
  ## Packaging a plugin in a gem
64
62
 
65
- In order for a formatter to use your plugin, it needs to know where to what path
66
- to require and the name of your plugin class to instantiate and invoke.
63
+ In order for a formatter to use your plugin, it needs to know what path to
64
+ require as well as the name of the plugin class to instantiate and invoke.
67
65
 
68
66
  To make this work seamlessly for your users without additional configuration of
69
67
  their own, all you need to do is specify a metadata attribute called
@@ -173,4 +171,3 @@ including (but not limited to) one-on-one communications, public posts/comments,
173
171
  code reviews, pull requests, and GitHub issues. If violations occur, Test Double
174
172
  will take any action they deem appropriate for the infraction, up to and
175
173
  including blocking a user from the organization's repositories.
176
-
@@ -0,0 +1,23 @@
1
+ module LintRoller
2
+ module Support
3
+ class MergesUpstreamMetadata
4
+ def merge(plugin_yaml, upstream_yaml)
5
+ common_upstream_values = upstream_yaml.select { |key| plugin_yaml.key?(key) }
6
+
7
+ plugin_yaml.merge(common_upstream_values) { |key, plugin_value, upstream_value|
8
+ if plugin_value.is_a?(Hash) && upstream_value.is_a?(Hash)
9
+ plugin_value.merge(upstream_value) { |sub_key, plugin_sub_value, upstream_sub_value|
10
+ if plugin_value.key?(sub_key)
11
+ plugin_sub_value
12
+ else
13
+ upstream_sub_value
14
+ end
15
+ }
16
+ else
17
+ plugin_value
18
+ end
19
+ }
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module LintRoller
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/lint_roller.rb CHANGED
@@ -7,5 +7,7 @@ require_relative "lint_roller/rules"
7
7
  require_relative "lint_roller/plugin"
8
8
  require_relative "lint_roller/error"
9
9
 
10
+ require_relative "lint_roller/support/merges_upstream_metadata"
11
+
10
12
  module LintRoller
11
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lint_roller
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-15 00:00:00.000000000 Z
11
+ date: 2023-07-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -30,6 +30,7 @@ files:
30
30
  - lib/lint_roller/error.rb
31
31
  - lib/lint_roller/plugin.rb
32
32
  - lib/lint_roller/rules.rb
33
+ - lib/lint_roller/support/merges_upstream_metadata.rb
33
34
  - lib/lint_roller/version.rb
34
35
  homepage: https://github.com/standardrb/lint_roller
35
36
  licenses:
@@ -53,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  requirements: []
56
- rubygems_version: 3.4.10
57
+ rubygems_version: 3.4.14
57
58
  signing_key:
58
59
  specification_version: 4
59
60
  summary: A plugin specification for linter and formatter rulesets