Skip to content

Commit ffdf1f3

Browse files
committed
Add RuboCop.
1 parent 9f5b1fb commit ffdf1f3

File tree

8 files changed

+99
-12
lines changed

8 files changed

+99
-12
lines changed

.github/workflows/rubocop.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test External
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
CONSOLE_OUTPUT: XTerm
10+
11+
jobs:
12+
test:
13+
name: ${{matrix.ruby}} on ${{matrix.os}}
14+
runs-on: ${{matrix.os}}-latest
15+
16+
strategy:
17+
matrix:
18+
os:
19+
- ubuntu
20+
- macos
21+
22+
ruby:
23+
- "3.1"
24+
- "3.2"
25+
- "3.3"
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: ${{matrix.ruby}}
32+
bundler-cache: true
33+
34+
- name: Run RuboCop
35+
timeout-minutes: 10
36+
run: bundle exec rubocop

.rubocop.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
AllCops:
2+
DisabledByDefault: true
3+
4+
Layout/IndentationStyle:
5+
Enabled: true
6+
EnforcedStyle: tabs
7+
8+
Layout/InitialIndentation:
9+
Enabled: true
10+
11+
Layout/IndentationWidth:
12+
Enabled: true
13+
Width: 1
14+
15+
Layout/IndentationConsistency:
16+
Enabled: true
17+
EnforcedStyle: normal
18+
19+
Layout/EndAlignment:
20+
Enabled: true
21+
EnforcedStyleAlignWith: start_of_line
22+
23+
Layout/BeginEndAlignment:
24+
Enabled: true
25+
EnforcedStyleAlignWith: start_of_line
26+
27+
Layout/ElseAlignment:
28+
Enabled: true
29+
30+
Layout/DefEndAlignment:
31+
Enabled: true
32+
33+
Layout/CaseIndentation:
34+
Enabled: true
35+
36+
Layout/CommentIndentation:
37+
Enabled: true
38+
39+
Layout/EmptyLinesAroundClassBody:
40+
Enabled: true
41+
42+
Layout/EmptyLinesAroundModuleBody:
43+
Enabled: true
44+
45+
Style/FrozenStringLiteralComment:
46+
Enabled: true

benchmark/test.rb

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
TYPE = ENV.fetch("TYPE", "pos")
88

99
describe "sus" do
10-
ITERATIONS.times do |n|
11-
case TYPE
12-
when "pos" then
13-
it "pos #{n}" do
14-
expect(1).to be == 1
15-
end
16-
when "neg" then
17-
it "neg #{n}" do
18-
expect(1).to be == 2
19-
end
20-
end
21-
end
10+
ITERATIONS.times do |n|
11+
case TYPE
12+
when "pos" then
13+
it "pos #{n}" do
14+
expect(1).to be == 1
15+
end
16+
when "neg" then
17+
it "neg #{n}" do
18+
expect(1).to be == 2
19+
end
20+
end
21+
end
2222
end

bin/sus

+1
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 'stackprof'
45
# StackProf.start(mode: :wall, interval: 10)

bin/sus-host

+1
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 'json'
45

bin/sus-parallel

+1
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_relative '../lib/sus/config'
45
config = Sus::Config.load

bin/sus-tree

+1
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 'json'
45

gems.rb

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
group :test do
1818
gem "covered"
1919
gem "decode"
20+
gem "rubocop"
2021

2122
gem "bake-test"
2223
gem "bake-test-external"

0 commit comments

Comments
 (0)