rubocop-fluentd 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/config/default.yml +5 -0
- data/lib/rubocop/cop/fluentd_cops.rb +1 -0
- data/lib/rubocop/cop/lint/plugin_config_param_time.rb +40 -0
- data/lib/rubocop/fluentd/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56610f49bc89a80c7cfc74091dbf9e0e5af8a2c7de39698bcf0b9464357d4682
|
4
|
+
data.tar.gz: b6fa1274a3afda983e6e5f3c7552476f664521a2e163343b0299178e46ab487d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f938ec1fec15a0c9d0f7aac29857a76853831f6b6bc19b1c2bf73846fbe6ade79ca003797b34a0d9538831f1cf2764d235036dd4d33e562dbfcc63a76b40240
|
7
|
+
data.tar.gz: f1131bc32c16d6ccaa783b8d40641735bcd7ce7ec3462a2e111212a4783afe02624e0ebfcb599b907d8a9ade2bfe4cf2a9d4ea9ed5d82b29f226d26853c5afeb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/config/default.yml
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Write it!
|
2
2
|
|
3
|
+
Lint/FluentdPluginConfigParamDefaultTime:
|
4
|
+
Description: 'Warn the default value of :time for config_param is string'
|
5
|
+
Enabled: true
|
6
|
+
VersionAdded: '0.1.1'
|
7
|
+
|
3
8
|
Lint/FluentdPluginLogLevel:
|
4
9
|
Description: 'Warn global scope `$log` was used in Fluentd plugin. The scope of plugin log level was supported since Fluentd 0.10.43'
|
5
10
|
Enabled: true
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Lint
|
6
|
+
#
|
7
|
+
# @example FluentdPluginConfigParamDefaultTime (default)
|
8
|
+
#
|
9
|
+
# # bad
|
10
|
+
# config_param :interval, :time, :default => '1h'
|
11
|
+
#
|
12
|
+
# # good
|
13
|
+
# config_param :interval, :time, :default => 3600
|
14
|
+
#
|
15
|
+
# See https://github.com/fluent/fluent-plugin-opensearch/pull/159
|
16
|
+
#
|
17
|
+
class FluentdPluginConfigParamDefaultTime < Base
|
18
|
+
include IgnoredNode
|
19
|
+
|
20
|
+
RESTRICT_ON_SEND = %i[config_param].freeze
|
21
|
+
|
22
|
+
# @!method config_param_default_time?(node)
|
23
|
+
def_node_matcher :config_param_default_string_time?, <<~PATTERN
|
24
|
+
(send nil? :config_param (sym _) (sym :time) (hash (pair (sym :default) (str _))))
|
25
|
+
PATTERN
|
26
|
+
|
27
|
+
def on_send(node)
|
28
|
+
return unless config_param_default_string_time?(node)
|
29
|
+
|
30
|
+
symbol = node.children[2]
|
31
|
+
parameter = symbol.value
|
32
|
+
message = "The value of :#{parameter} must be `integer` or `float` for default time value."
|
33
|
+
add_offense(node, message: message)
|
34
|
+
ignore_node(node)
|
35
|
+
end
|
36
|
+
alias on_csend on_send
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-fluentd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Hayashi
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- config/default.yml
|
54
54
|
- lib/rubocop-fluentd.rb
|
55
55
|
- lib/rubocop/cop/fluentd_cops.rb
|
56
|
+
- lib/rubocop/cop/lint/plugin_config_param_time.rb
|
56
57
|
- lib/rubocop/cop/lint/plugin_log_scope.rb
|
57
58
|
- lib/rubocop/cop/performance/plugin_log_string_interpolation.rb
|
58
59
|
- lib/rubocop/fluentd.rb
|