rubocop-disable_syntax 0.1.1 → 0.2.0
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 +5 -0
- data/README.md +5 -3
- data/lib/rubocop/disable_syntax/plugin.rb +32 -0
- data/lib/rubocop/disable_syntax/version.rb +1 -1
- data/lib/rubocop/disable_syntax.rb +0 -5
- data/lib/rubocop-disable_syntax.rb +1 -4
- metadata +22 -7
- data/lib/rubocop/disable_syntax/inject.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03637f71e53c2813b2ce98e8b9d6e36269d1775d0d9a44991bdd70556e1daff4
|
4
|
+
data.tar.gz: 6a3a1a2a71e67a870f3606805a4883176ff81f18662c0e969fdd1139594d4649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6a3347551862531a90513a0f646747a392d0d1ea65d317e09936a81b2a515cc31286e06953b8272a4fae03ae5e21b61f74a97e02c503059e503732e810e51d4
|
7
|
+
data.tar.gz: ca3e4065ac8ae77aad96a59f8f224a04ac7e960f1d09c122e8aba62ce8849aef16d9be1982947d501acfcba49f8da80d0d984e3c0f37cec619570c9bd3984af6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
## Requirements
|
8
8
|
|
9
|
-
- ruby 2
|
10
|
-
- rubocop 1.
|
9
|
+
- ruby 3.2+
|
10
|
+
- rubocop 1.72+
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -30,10 +30,12 @@ You need to tell RuboCop to load the `rubocop-disable_syntax` extension.
|
|
30
30
|
Put this into your `.rubocop.yml`.
|
31
31
|
|
32
32
|
```yaml
|
33
|
-
|
33
|
+
plugins:
|
34
34
|
- rubocop-disable_syntax
|
35
35
|
```
|
36
36
|
|
37
|
+
**Note**: The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
|
38
|
+
|
37
39
|
All the ruby syntax features are enabled by default and so this gem acts as a no-op. You need to manually configure
|
38
40
|
which ruby features you want to disable:
|
39
41
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lint_roller"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module DisableSyntax
|
7
|
+
# A plugin that integrates RuboCop Disable Syntax with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
name: "rubocop-disable_syntax",
|
12
|
+
version: VERSION,
|
13
|
+
homepage: "https://github.com/fatkodima/rubocop-disable_syntax",
|
14
|
+
description: "A RuboCop plugin that allows to disable some unfavorite ruby syntax, " \
|
15
|
+
"such as `unless`, safe navigation etc."
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def supported?(context)
|
20
|
+
context.engine == :rubocop
|
21
|
+
end
|
22
|
+
|
23
|
+
def rules(_context)
|
24
|
+
LintRoller::Rules.new(
|
25
|
+
type: :path,
|
26
|
+
config_format: :rubocop,
|
27
|
+
value: Pathname.new(__dir__).join("../../../config/default.yml")
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -4,10 +4,5 @@ require_relative "disable_syntax/version"
|
|
4
4
|
|
5
5
|
module RuboCop
|
6
6
|
module DisableSyntax
|
7
|
-
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
8
|
-
CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default.yml").freeze
|
9
|
-
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
10
|
-
|
11
|
-
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
12
7
|
end
|
13
8
|
end
|
@@ -4,8 +4,5 @@ require "rubocop"
|
|
4
4
|
|
5
5
|
require_relative "rubocop/disable_syntax"
|
6
6
|
require_relative "rubocop/disable_syntax/version"
|
7
|
-
require_relative "rubocop/disable_syntax/
|
8
|
-
|
9
|
-
RuboCop::DisableSyntax::Inject.defaults!
|
10
|
-
|
7
|
+
require_relative "rubocop/disable_syntax/plugin"
|
11
8
|
require_relative "rubocop/cop/style/disable_syntax"
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-disable_syntax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fatkodima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lint_roller
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rubocop
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
33
|
+
version: 1.72.0
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
40
|
+
version: 1.72.0
|
27
41
|
description:
|
28
42
|
email:
|
29
43
|
- fatkodima123@gmail.com
|
@@ -38,7 +52,7 @@ files:
|
|
38
52
|
- lib/rubocop-disable_syntax.rb
|
39
53
|
- lib/rubocop/cop/style/disable_syntax.rb
|
40
54
|
- lib/rubocop/disable_syntax.rb
|
41
|
-
- lib/rubocop/disable_syntax/
|
55
|
+
- lib/rubocop/disable_syntax/plugin.rb
|
42
56
|
- lib/rubocop/disable_syntax/version.rb
|
43
57
|
homepage: https://github.com/fatkodima/rubocop-disable_syntax
|
44
58
|
licenses:
|
@@ -47,6 +61,7 @@ metadata:
|
|
47
61
|
homepage_uri: https://github.com/fatkodima/rubocop-disable_syntax
|
48
62
|
source_code_uri: https://github.com/fatkodima/rubocop-disable_syntax
|
49
63
|
changelog_uri: https://github.com/fatkodima/rubocop-disable_syntax/blob/master/CHANGELOG.md
|
64
|
+
default_lint_roller_plugin: RuboCop::DisableSyntax::Plugin
|
50
65
|
post_install_message:
|
51
66
|
rdoc_options: []
|
52
67
|
require_paths:
|
@@ -55,14 +70,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
70
|
requirements:
|
56
71
|
- - ">="
|
57
72
|
- !ruby/object:Gem::Version
|
58
|
-
version: 2.
|
73
|
+
version: 3.2.0
|
59
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
75
|
requirements:
|
61
76
|
- - ">="
|
62
77
|
- !ruby/object:Gem::Version
|
63
78
|
version: '0'
|
64
79
|
requirements: []
|
65
|
-
rubygems_version: 3.4.
|
80
|
+
rubygems_version: 3.4.19
|
66
81
|
signing_key:
|
67
82
|
specification_version: 4
|
68
83
|
summary: A RuboCop plugin that allows to disable some unfavorite ruby syntax, such
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
4
|
-
# See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
|
5
|
-
module RuboCop
|
6
|
-
module DisableSyntax
|
7
|
-
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
8
|
-
# bit of our configuration.
|
9
|
-
module Inject
|
10
|
-
def self.defaults!
|
11
|
-
path = CONFIG_DEFAULT.to_s
|
12
|
-
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
13
|
-
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
14
|
-
puts "configuration from #{path}" if ConfigLoader.debug?
|
15
|
-
config = ConfigLoader.merge_with_default(config, path)
|
16
|
-
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|