rubocop-redis-rb 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fe550152ecf81619ed0e691bd8c4bbdee5229750a314a1e5d78b516c9eee1124
4
+ data.tar.gz: 271ec1e371f4b2c6b0105c7f253656cbc11ea3abb93cf07cd8255c875815ec01
5
+ SHA512:
6
+ metadata.gz: cdcaf1bc97f592960b223839be53fb5e7217a75b22e09464e581a7491662c72254c0cb9e6f5001e4e7f8830313b4f59229d5fcfe678c24a92b8c5241d9ae2da3
7
+ data.tar.gz: 6c922aa5ab402f0c05e7b58e59a0b14befa81f5b13222c89036f13a2c5c9c9b68b9752d1c5657fad5047226067bd858334f436b71de4598f20455b74715d8fca
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
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
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in rubocop-redis-rb.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,58 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rubocop-redis-rb (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ json (2.6.2)
12
+ parallel (1.22.1)
13
+ parser (3.1.2.1)
14
+ ast (~> 2.4.1)
15
+ rainbow (3.1.1)
16
+ rake (13.0.6)
17
+ regexp_parser (2.5.0)
18
+ rexml (3.2.5)
19
+ rspec (3.11.0)
20
+ rspec-core (~> 3.11.0)
21
+ rspec-expectations (~> 3.11.0)
22
+ rspec-mocks (~> 3.11.0)
23
+ rspec-core (3.11.0)
24
+ rspec-support (~> 3.11.0)
25
+ rspec-expectations (3.11.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.11.0)
28
+ rspec-mocks (3.11.1)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.11.0)
31
+ rspec-support (3.11.0)
32
+ rubocop (1.35.1)
33
+ json (~> 2.3)
34
+ parallel (~> 1.10)
35
+ parser (>= 3.1.2.1)
36
+ rainbow (>= 2.2.2, < 4.0)
37
+ regexp_parser (>= 1.8, < 3.0)
38
+ rexml (>= 3.2.5, < 4.0)
39
+ rubocop-ast (>= 1.20.1, < 2.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 3.0)
42
+ rubocop-ast (1.21.0)
43
+ parser (>= 3.1.1.0)
44
+ ruby-progressbar (1.11.0)
45
+ unicode-display_width (2.2.0)
46
+
47
+ PLATFORMS
48
+ x86_64-darwin-20
49
+ x86_64-linux
50
+
51
+ DEPENDENCIES
52
+ rake (~> 13.0)
53
+ rspec (~> 3.0)
54
+ rubocop (~> 1.21)
55
+ rubocop-redis-rb!
56
+
57
+ BUNDLED WITH
58
+ 2.3.8
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Rubocop redis-rb
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-rb'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rubocop-redis-rb
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-rb.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -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,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'redis-rb/not_keys'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rubocop
4
+ module RedisRb
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ # RuboCop RedisRb project namespace
5
+ module RedisRb
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop'
4
+ require_relative "rubocop/redis-rb/version"
5
+
6
+ module Rubocop
7
+ module RedisRb
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
11
+ end
12
+
13
+ require_relative 'rubocop/cop/redis-rb_cops'
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rubocop/redis-rb/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rubocop-redis-rb"
7
+ spec.version = Rubocop::RedisRb::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-rb gem."
12
+ spec.description = "An extension of RuboCop for redis/redis-rb gem."
13
+ spec.homepage = "https://github.com/9sako6/rubocop-redis-rb"
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-rb"
18
+ spec.metadata["changelog_uri"] = "https://github.com/9sako6/rubocop-redis-rb"
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,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubocop-redis-rb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - 9sako6
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: An extension of RuboCop for redis/redis-rb 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
+ - Gemfile.lock
24
+ - README.md
25
+ - Rakefile
26
+ - lib/rubocop-redis-rb.rb
27
+ - lib/rubocop/cop/redis-rb/not_keys.rb
28
+ - lib/rubocop/cop/redis-rb_cops.rb
29
+ - lib/rubocop/redis-rb.rb
30
+ - lib/rubocop/redis-rb/version.rb
31
+ - rubocop-redis-rb.gemspec
32
+ homepage: https://github.com/9sako6/rubocop-redis-rb
33
+ licenses: []
34
+ metadata:
35
+ homepage_uri: https://github.com/9sako6/rubocop-redis-rb
36
+ source_code_uri: https://github.com/9sako6/rubocop-redis-rb
37
+ changelog_uri: https://github.com/9sako6/rubocop-redis-rb
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.6.0
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubygems_version: 3.3.4
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: An extension of RuboCop for redis/redis-rb gem.
57
+ test_files: []