Skip to content

Commit

Permalink
Add RuboCop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jul 18, 2024
1 parent 9f5b1fb commit ffdf1f3
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 12 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/rubocop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test External

on: [push, pull_request]

permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm

jobs:
test:
name: ${{matrix.ruby}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest

strategy:
matrix:
os:
- ubuntu
- macos

ruby:
- "3.1"
- "3.2"
- "3.3"

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true

- name: Run RuboCop
timeout-minutes: 10
run: bundle exec rubocop
46 changes: 46 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
AllCops:
DisabledByDefault: true

Layout/IndentationStyle:
Enabled: true
EnforcedStyle: tabs

Layout/InitialIndentation:
Enabled: true

Layout/IndentationWidth:
Enabled: true
Width: 1

Layout/IndentationConsistency:
Enabled: true
EnforcedStyle: normal

Layout/EndAlignment:
Enabled: true
EnforcedStyleAlignWith: start_of_line

Layout/BeginEndAlignment:
Enabled: true
EnforcedStyleAlignWith: start_of_line

Layout/ElseAlignment:
Enabled: true

Layout/DefEndAlignment:
Enabled: true

Layout/CaseIndentation:
Enabled: true

Layout/CommentIndentation:
Enabled: true

Layout/EmptyLinesAroundClassBody:
Enabled: true

Layout/EmptyLinesAroundModuleBody:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: true
24 changes: 12 additions & 12 deletions benchmark/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
TYPE = ENV.fetch("TYPE", "pos")

describe "sus" do
ITERATIONS.times do |n|
case TYPE
when "pos" then
it "pos #{n}" do
expect(1).to be == 1
end
when "neg" then
it "neg #{n}" do
expect(1).to be == 2
end
end
end
ITERATIONS.times do |n|
case TYPE
when "pos" then
it "pos #{n}" do
expect(1).to be == 1
end
when "neg" then
it "neg #{n}" do
expect(1).to be == 2
end
end
end
end
1 change: 1 addition & 0 deletions bin/sus
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# require 'stackprof'
# StackProf.start(mode: :wall, interval: 10)
Expand Down
1 change: 1 addition & 0 deletions bin/sus-host
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'json'

Expand Down
1 change: 1 addition & 0 deletions bin/sus-parallel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative '../lib/sus/config'
config = Sus::Config.load
Expand Down
1 change: 1 addition & 0 deletions bin/sus-tree
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'json'

Expand Down
1 change: 1 addition & 0 deletions gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
group :test do
gem "covered"
gem "decode"
gem "rubocop"

gem "bake-test"
gem "bake-test-external"
Expand Down

0 comments on commit ffdf1f3

Please sign in to comment.