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 +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +2 -1
- data/README.md +9 -12
- data/lib/lint_roller/support/merges_upstream_metadata.rb +23 -0
- data/lib/lint_roller/version.rb +1 -1
- data/lib/lint_roller.rb +2 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2fd0d1d1ea02f68478b1c2494f5653b2bb8eca764d86d1b3879188fa80cf5ec
|
4
|
+
data.tar.gz: 3e2b04be9ea384a8e2a76a370bd41c9265a951f3b49af8377b9108276c20e67d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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
|
-
|
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
|
60
|
-
|
61
|
-
|
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
|
66
|
-
|
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
|
data/lib/lint_roller/version.rb
CHANGED
data/lib/lint_roller.rb
CHANGED
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.
|
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-
|
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.
|
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
|