Skip to content

Commit 3ffa935

Browse files
Merge pull request #120 from basecamp/rubocop
Set up RuboCop with CI
2 parents 78d3087 + bdfca0a commit 3ffa935

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+192
-19
lines changed

.github/workflows/rubocop.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: RuboCop
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Ruby 3.2
16+
uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: 3.2
19+
bundler-cache: true
20+
21+
- name: Run RuboCop
22+
run: bundle exec rubocop --parallel

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.gem
2+
.rubocop-*

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
inherit_from: https://raw.githubusercontent.com/rails/rails/main/.rubocop.yml

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24

35
gemspec
46

57
gem "rake"
68
gem "debug", ">= 1.0.0"
9+
gem "rubocop"
10+
gem "rubocop-minitest"
11+
gem "rubocop-packaging"
12+
gem "rubocop-performance"
13+
gem "rubocop-rails"
14+
gem "rubocop-md"

Gemfile.lock

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ GEM
6868
minitest (>= 5.1)
6969
tzinfo (~> 2.0)
7070
zeitwerk (~> 2.3)
71+
ast (2.4.2)
7172
builder (3.2.4)
7273
concurrent-ruby (1.1.8)
7374
connection_pool (2.4.1)
@@ -83,6 +84,8 @@ GEM
8384
io-console (0.6.0)
8485
irb (1.7.1)
8586
reline (>= 0.3.0)
87+
json (2.6.3)
88+
language_server-protocol (3.17.0.3)
8689
loofah (2.9.0)
8790
crass (~> 1.0.2)
8891
nokogiri (>= 1.5.9)
@@ -101,6 +104,10 @@ GEM
101104
racc (~> 1.4)
102105
nokogiri (1.15.2-x86_64-darwin)
103106
racc (~> 1.4)
107+
parallel (1.23.0)
108+
parser (3.2.2.3)
109+
ast (~> 2.4.1)
110+
racc
104111
racc (1.7.1)
105112
rack (2.2.3)
106113
rack-test (1.1.0)
@@ -131,13 +138,43 @@ GEM
131138
method_source
132139
rake (>= 0.8.7)
133140
thor (~> 1.0)
141+
rainbow (3.1.1)
134142
rake (13.0.3)
135143
redis (5.0.6)
136144
redis-client (>= 0.9.0)
137145
redis-client (0.14.1)
138146
connection_pool
147+
regexp_parser (2.8.1)
139148
reline (0.3.6)
140149
io-console (~> 0.5)
150+
rexml (3.2.5)
151+
rubocop (1.54.1)
152+
json (~> 2.3)
153+
language_server-protocol (>= 3.17.0)
154+
parallel (~> 1.10)
155+
parser (>= 3.2.2.3)
156+
rainbow (>= 2.2.2, < 4.0)
157+
regexp_parser (>= 1.8, < 3.0)
158+
rexml (>= 3.2.5, < 4.0)
159+
rubocop-ast (>= 1.28.0, < 2.0)
160+
ruby-progressbar (~> 1.7)
161+
unicode-display_width (>= 2.4.0, < 3.0)
162+
rubocop-ast (1.29.0)
163+
parser (>= 3.2.1.0)
164+
rubocop-md (1.2.0)
165+
rubocop (>= 1.0)
166+
rubocop-minitest (0.31.0)
167+
rubocop (>= 1.39, < 2.0)
168+
rubocop-packaging (0.5.2)
169+
rubocop (>= 1.33, < 2.0)
170+
rubocop-performance (1.18.0)
171+
rubocop (>= 1.7.0, < 2.0)
172+
rubocop-ast (>= 0.4.0)
173+
rubocop-rails (2.20.2)
174+
activesupport (>= 4.2.0)
175+
rack (>= 1.1)
176+
rubocop (>= 1.33.0, < 2.0)
177+
ruby-progressbar (1.13.0)
141178
sprockets (4.0.2)
142179
concurrent-ruby (~> 1.0)
143180
rack (> 1, < 3)
@@ -148,6 +185,7 @@ GEM
148185
thor (1.1.0)
149186
tzinfo (2.0.4)
150187
concurrent-ruby (~> 1.0)
188+
unicode-display_width (2.4.2)
151189
websocket-driver (0.7.3)
152190
websocket-extensions (>= 0.1.0)
153191
websocket-extensions (0.1.5)
@@ -163,6 +201,12 @@ DEPENDENCIES
163201
kredis!
164202
rails (>= 6.0.0)
165203
rake
204+
rubocop
205+
rubocop-md
206+
rubocop-minitest
207+
rubocop-packaging
208+
rubocop-performance
209+
rubocop-rails
166210

167211
BUNDLED WITH
168212
2.3.12

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ integer.value = 5 # => SET myinteger "5"
2121
5 == integer.value # => GET myinteger
2222

2323
decimal = Kredis.decimal "mydecimal" # accuracy!
24-
decimal.value = "%.47f" % (1.0/10) # => SET mydecimal "0.10000000000000000555111512312578270211815834045"
24+
decimal.value = "%.47f" % (1.0 / 10) # => SET mydecimal "0.10000000000000000555111512312578270211815834045"
2525
BigDecimal("0.10000000000000000555111512312578270211815834045e0") == decimal.value # => GET mydecimal
2626

2727
float = Kredis.float "myfloat" # speed!
28-
float.value = 1.0/10 # => SET myfloat "0.1"
28+
float.value = 1.0 / 10 # => SET myfloat "0.1"
2929
0.1 == float.value # => GET myfloat
3030

3131
boolean = Kredis.boolean "myboolean"
@@ -228,14 +228,14 @@ If you need to connect to Redis with SSL, the recommended approach is to set you
228228

229229
```ruby
230230
Kredis::Connections.connections[:shared] = Redis.new(
231-
url: ENV['REDIS_URL'],
231+
url: ENV["REDIS_URL"],
232232
ssl_params: {
233233
cert_store: OpenSSL::X509::Store.new.tap { |store|
234-
store.add_file(Rails.root.join('config', 'ca_cert.pem').to_s)
234+
store.add_file(Rails.root.join("config", "ca_cert.pem").to_s)
235235
},
236236

237237
cert: OpenSSL::X509::Certificate.new(File.read(
238-
Rails.root.join('config', 'client.crt')
238+
Rails.root.join("config", "client.crt")
239239
)),
240240

241241
key: OpenSSL::PKey::RSA.new(

bin/console

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
require "irb"
45
require "bundler/inline"

bin/test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
$: << File.expand_path("../test", __dir__)
35

46
require "bundler/setup"

kredis.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require_relative "lib/kredis/version"
24

35
Gem::Specification.new do |s|

lib/install/install.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
yaml_path = Rails.root.join("config/redis/shared.yml")
24
unless yaml_path.exist?
35
say "Adding `config/redis/shared.yml`"

0 commit comments

Comments
 (0)