Skip to content

Commit e39b12c

Browse files
rubocopness and file renaming
1 parent 6e17bb8 commit e39b12c

23 files changed

+366
-389
lines changed

.github/shared/setup/action.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "setup ruby"
2+
description: "setup ruby"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Set up Ruby
8+
uses: ruby/setup-ruby@v1
9+
with:
10+
bundler-cache: true
11+
working-directory: ./2024/ruby

.github/workflows/2018-ruby.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ jobs:
2626
with:
2727
ruby-version: ${{ steps.determine-ruby-version.outputs.VERSION }}
2828
bundler-cache: true
29+
working-directory: ./2018/ruby
2930
- name: Run tests
3031
run: bundle exec rspec

.github/workflows/2021-ruby.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ jobs:
2626
with:
2727
ruby-version: ${{ steps.determine-ruby-version.outputs.VERSION }}
2828
bundler-cache: true
29+
working-directory: ./2021/ruby
2930
- name: Run tests
3031
run: bundle exec rspec

.github/workflows/2024-ruby.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: 2024-ruby
33
on:
44
pull_request:
55
push:
6-
branches: [master]
76
paths:
87
- 2024/ruby/**
98

@@ -12,14 +11,19 @@ defaults:
1211
working-directory: ./2024/ruby
1312

1413
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Setup Ruby
19+
uses: ./.github/shared/setup
20+
- name: Run rubocop
21+
run: bundle exec rubocop
1522
tests:
1623
runs-on: ubuntu-latest
1724
steps:
18-
- uses: actions/checkout@v3
19-
- name: Set up Ruby
20-
uses: ruby/setup-ruby@v1
21-
with:
22-
bundler-cache: true
23-
working-directory: ./2024/ruby
24-
- name: Run tests
25-
run: bundle exec rspec
25+
- uses: actions/checkout@v3
26+
- name: Setup Ruby
27+
uses: ./.github/shared/setup
28+
- name: Run tests
29+
run: bundle exec rspec

2018/ruby/spec/advent_03_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
expect(rectangle.width).to eq(4)
3030
end
3131

32-
it "solves the puzzle", solution: true do
32+
it "solves the puzzle", solution: true, slow: true do
3333
reader = ClaimReader.new(puzzle_input)
3434
claims = reader.process
3535

2018/ruby/spec/advent_05_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
end
2525
end
2626

27-
xit "solves part 1" do
27+
it "solves part 1", slow: true do
2828
reader = AlchemicalReduction.new(puzzle_input)
2929
reader.process
3030

@@ -55,7 +55,7 @@
5555
expect(lowest[1]).to eq(4)
5656
end
5757

58-
xit "solves part 2" do
58+
it "solves part 2", slow: true do
5959
counts = {}
6060

6161
('a'..'z').each do |letter|

2018/ruby/spec/advent_06_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,17 @@
3030
expect(c.largest_area).to eq(17)
3131
end
3232

33-
xit "solves part 1" do
33+
it "solves part 1", slow: true do
3434
coordinates = puzzle_input.collect do |item|
3535
Coordinate.new(item[0], item[1])
3636
end
3737

3838
c = ChronalCoordinates.new(coordinates)
39-
# c.print_grid
4039

4140
expect(c.largest_area).to eq(3401)
4241
end
4342

44-
it "solves part 2" do
43+
it "solves part 2", slow: true do
4544
coordinates = puzzle_input.collect do |item|
4645
Coordinate.new(item[0], item[1])
4746
end

2018/ruby/spec/advent_07_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def create_graph(input, weighted = false, seed_weight = 0)
5858
expect(orderer.compressed_order).to eq("CABDFE")
5959
end
6060

61-
xit "figures out the puzzle order" do
61+
it "figures out the puzzle order", slow: true do
6262
graph = create_graph(puzzle_input)
6363

6464
orderer = Orderer.new(graph)
@@ -76,7 +76,7 @@ def create_graph(input, weighted = false, seed_weight = 0)
7676
expect(seconds).to eq(15)
7777
end
7878

79-
xit "figures out part 2 puzzle order" do
79+
it "figures out part 2 puzzle order", slow: true do
8080
graph = create_graph(puzzle_input, true, 60)
8181

8282
orderer = Orderer.new(graph)

2024/ruby/.rubocop_todo.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,3 @@ Metrics/BlockLength:
2121
# Configuration parameters: CountComments, CountAsOne.
2222
Metrics/ClassLength:
2323
Max: 120
24-
25-
# Offense count: 2
26-
# Configuration parameters: EnforcedStyle, AllowedPatterns.
27-
# SupportedStyles: snake_case, camelCase
28-
Naming/MethodName:
29-
Exclude:
30-
- 'lib/advent_04_ceres_search.rb'
31-
- 'test.rb'
32-
33-
# Offense count: 2
34-
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
35-
# SupportedStyles: snake_case, normalcase, non_integer
36-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
37-
Naming/VariableNumber:
38-
Exclude:
39-
- 'lib/advent_04_ceres_search.rb'
40-
41-
# Offense count: 4
42-
# Configuration parameters: AllowedConstants.
43-
Style/Documentation:
44-
Exclude:
45-
- 'spec/**/*'
46-
- 'test/**/*'
47-
- 'lib/advent_01_hystorian_hysteria.rb'
48-
- 'lib/advent_02_red_nosed_reports.rb'
49-
- 'lib/advent_03_mull_it_over.rb'
50-
- 'lib/advent_04_ceres_search.rb'

2024/ruby/Gemfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44

5-
ruby File.open('.ruby-version', 'rb') { |f| f.read.chomp }
5+
ruby File.open(".ruby-version", "rb") { |f| f.read.chomp }
66

7-
gem 'awesome_print'
7+
gem "awesome_print"
88

9-
gem 'guard'
10-
gem 'guard-rspec', require: false
9+
gem "guard"
10+
gem "guard-rspec", require: false
1111

12-
gem 'pry', '~> 0.15.0'
12+
gem "pry", "~> 0.15.0"
1313

14-
gem 'rake', '~> 13.2'
15-
gem 'rspec', '~> 3.13.0'
16-
gem 'rubocop', '~> 1.69.0'
17-
gem 'rubocop-rake', '0.6.0', require: false
18-
gem 'rubocop-rspec', '3.2.0', require: false
14+
gem "rake", "~> 13.2"
15+
gem "rspec", "~> 3.13.0"
16+
gem "rubocop", "~> 1.69.0"
17+
gem "rubocop-rake", "0.6.0", require: false
18+
gem "rubocop-rspec", "3.2.0", require: false

0 commit comments

Comments
 (0)