rubocop-redis 0.1.2
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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +19 -0
- data/Gemfile +12 -0
- data/README.md +27 -0
- data/Rakefile +12 -0
- data/config/default.yml +6 -0
- data/lib/rubocop/cop/redis/not_keys.rb +24 -0
- data/lib/rubocop/cop/redis_cops.rb +3 -0
- data/lib/rubocop/redis/inject.rb +20 -0
- data/lib/rubocop/redis/version.rb +7 -0
- data/lib/rubocop/redis.rb +7 -0
- data/lib/rubocop-redis.rb +10 -0
- data/rubocop-redis.gemspec +36 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 479c3bae5bed1f65f985ba12a41b57828d03a74a822066112fde6fa9f478214a
|
4
|
+
data.tar.gz: fb9ea8b8ff4c8f586d9e060a49a085abef336c15e04f5a8d6155f568fa6c9854
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a72c9dd2111a7708d6a2be7dd647c429f6eb35ed4be3f9b241d708ea6120b245608dfa87458eaf9f926162cf42882b950cc86ea82e1500275ade15e2047f61ce
|
7
|
+
data.tar.gz: 440440c4c738fc46270389dbc1810ab63066bcd420703d8776c79cce00f5fba9d98f92d78384916ad731addd1d8abfae335fb8160fc4602cf9067d19716f467d
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Style/StringLiterals:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 999
|
17
|
+
|
18
|
+
Naming/FileName:
|
19
|
+
Enabled: false
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# rubocop-redis
|
2
|
+
|
3
|
+
An extension of RuboCop for [redis/redis-rb](https://github.com/redis/redis-rb) Redis client.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rubocop-redis'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rubocop-redis
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/9sako6/rubocop-redis.
|
data/Rakefile
ADDED
data/config/default.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Redis
|
6
|
+
# This cop detects the use of `KEYS` query that should be noted when used in a production environment.
|
7
|
+
class NotKeys < Base
|
8
|
+
MSG = "Do not use `.keys`. It may ruin performance when it is executed against large databases. See https://redis.io/commands/keys/ for details."
|
9
|
+
|
10
|
+
def_node_matcher :keys_call?, <<~PATTERN
|
11
|
+
(send
|
12
|
+
(send
|
13
|
+
(const {cbase nil?} :Redis) :current) :keys $...)
|
14
|
+
PATTERN
|
15
|
+
|
16
|
+
def on_send(node)
|
17
|
+
return unless keys_call?(node)
|
18
|
+
|
19
|
+
add_offense(node)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Redis
|
5
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
6
|
+
# bit of our configuration.
|
7
|
+
module Inject
|
8
|
+
def self.defaults!
|
9
|
+
project_root = Pathname.new(__dir__).parent.parent.parent.expand_path
|
10
|
+
config_default = project_root.join('config', 'default.yml')
|
11
|
+
path = config_default.to_s
|
12
|
+
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
13
|
+
config = RuboCop::Config.new(hash, path)
|
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
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/rubocop/redis/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rubocop-redis"
|
7
|
+
spec.version = Rubocop::Redis::VERSION
|
8
|
+
spec.authors = ["9sako6"]
|
9
|
+
spec.email = ["31821663+9sako6@users.noreply.github.com"]
|
10
|
+
|
11
|
+
spec.summary = "An extension of RuboCop for redis/redis gem."
|
12
|
+
spec.description = "An extension of RuboCop for redis/redis gem."
|
13
|
+
spec.homepage = "https://github.com/9sako6/rubocop-redis"
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/9sako6/rubocop-redis"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/9sako6/rubocop-redis"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
# Uncomment to register a new dependency of your gem
|
32
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
33
|
+
|
34
|
+
# For more information and examples about making a new gem, check out our
|
35
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubocop-redis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- 9sako6
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-08-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: An extension of RuboCop for redis/redis gem.
|
14
|
+
email:
|
15
|
+
- 31821663+9sako6@users.noreply.github.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".rspec"
|
21
|
+
- ".rubocop.yml"
|
22
|
+
- Gemfile
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- config/default.yml
|
26
|
+
- lib/rubocop-redis.rb
|
27
|
+
- lib/rubocop/cop/redis/not_keys.rb
|
28
|
+
- lib/rubocop/cop/redis_cops.rb
|
29
|
+
- lib/rubocop/redis.rb
|
30
|
+
- lib/rubocop/redis/inject.rb
|
31
|
+
- lib/rubocop/redis/version.rb
|
32
|
+
- rubocop-redis.gemspec
|
33
|
+
homepage: https://github.com/9sako6/rubocop-redis
|
34
|
+
licenses: []
|
35
|
+
metadata:
|
36
|
+
homepage_uri: https://github.com/9sako6/rubocop-redis
|
37
|
+
source_code_uri: https://github.com/9sako6/rubocop-redis
|
38
|
+
changelog_uri: https://github.com/9sako6/rubocop-redis
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.6.0
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubygems_version: 3.3.4
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: An extension of RuboCop for redis/redis gem.
|
58
|
+
test_files: []
|