Skip to content

Commit

Permalink
Merge pull request #337 from ruby-formatter/ruby-34
Browse files Browse the repository at this point in the history
Add Ruby 3.4 to CI matrix
  • Loading branch information
kzkn authored Jan 8, 2025
2 parents 137d49f + a636e11 commit 963dab2
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby_version: ['3.3', '3.2', '3.1', '3.0']
ruby_version: ['3.4', '3.3', '3.2', '3.1', '3.0']

steps:
- uses: actions/checkout@v3
Expand Down
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,14 @@ source "https://rubygems.org"

# Specify your gem's dependencies in rufo.gemspec
gemspec

gem "bundler", ">= 1.15"
gem "byebug", "~> 11.1.3"
gem "guard-rspec", "~> 4.0"
gem "rake", "~> 13.0"
gem "rexml", "~> 3.2.5"
gem "rspec", "~> 3.0"
gem "rspec_junit_formatter", "~> 0.6.0"
gem "rubocop", "~> 1.69.2"
gem "simplecov", "~> 0.22.0"
gem "simplecov-cobertura", "~> 2.1"
14 changes: 12 additions & 2 deletions bin/verify-sample-code
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
repos = {
"rspec/rspec-expectations" => {},
"rspec/rspec-mocks" => {},
"rspec/rspec-core" => {
"--exclude-pattern" => [
"spec/rspec/core/world_spec.rb",
"spec/rspec/core/formatters/exception_presenter_spec.rb",
"spec/rspec/core/formatters/snippet_extractor_spec.rb",
"spec/rspec/core/metadata_spec.rb",
"spec/rspec/core/formatters/html_formatter_spec.rb",
"spec/rspec/core/formatters/progress_formatter_spec.rb",
"spec/rspec/core/formatters_spec.rb",
"spec/rspec/core/formatters/documentation_formatter_spec.rb",
].join(","),
},
}

def run_command(cmd, allowed_statuses: [0])
Expand Down
2 changes: 1 addition & 1 deletion lib/rufo/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ def visit_literal_elements(elements, inside_hash: false, inside_array: false, to
base_column = @column
base_line = @line
needs_final_space = (inside_hash || inside_array) && space?
first_space = skip_space
skip_space

if inside_hash
needs_final_space = false
Expand Down
11 changes: 0 additions & 11 deletions rufo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,4 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.required_ruby_version = ">= 3.0.0"
spec.metadata["rubygems_mfa_required"] = "true"

spec.add_development_dependency "bundler", ">= 1.15"
spec.add_development_dependency "byebug", "~> 11.1.3"
spec.add_development_dependency "guard-rspec", "~> 4.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rexml", "~> 3.2.5"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.6.0"
spec.add_development_dependency "rubocop", "~> 1.44.1"
spec.add_development_dependency "simplecov", "~> 0.22.0"
spec.add_development_dependency "simplecov-cobertura", "~> 2.1"
end
8 changes: 6 additions & 2 deletions spec/lib/rufo/formatter_source_specs/begin_rescue_end.rb.spec
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,19 @@ end

begin
1
else
rescue
2
else
3
end

#~# EXPECTED
begin
1
else
rescue
2
else
3
end

#~# ORIGINAL
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/rufo/formatter_source_specs/pattern_matching.rb.spec
Original file line number Diff line number Diff line change
Expand Up @@ -395,25 +395,29 @@ end

#~# ORIGINAL pin local variable

b=1
case a
in ^ b
1
end

#~# EXPECTED
b = 1
case a
in ^b
1
end

#~# ORIGINAL pin local variable with rest

b=1
case a
in ^b, *c
1
end

#~# EXPECTED
b = 1
case a
in ^b, *c
1
Expand Down
16 changes: 8 additions & 8 deletions spec/lib/rufo/formatter_source_specs/suffix_rescue.rb.spec
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#~# ORIGINAL

URI(string) rescue return
URI(string) rescue nil

#~# EXPECTED
URI(string) rescue return
URI(string) rescue nil

#~# ORIGINAL

URI(string) while return
URI(string) while nil

#~# EXPECTED
URI(string) while return
URI(string) while nil

#~# ORIGINAL

URI(string) if return
URI(string) if nil

#~# EXPECTED
URI(string) if return
URI(string) if nil

#~# ORIGINAL

URI(string) unless return
URI(string) unless nil

#~# EXPECTED
URI(string) unless return
URI(string) unless nil

#~# ORIGINAL
a, b = raise rescue [1, 2]
Expand Down

0 comments on commit 963dab2

Please sign in to comment.