Skip to content

Commit

Permalink
Add Ruby 3.1 to CI (rouge-ruby#1791)
Browse files Browse the repository at this point in the history
* Add Ruby 3.1 to CI

* Update Rubocop to be compatible with Ruby 3.1
  • Loading branch information
petergoldstein authored Feb 3, 2022
1 parent ba54616 commit 067881e
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [ '2.5', '2.6', '2.7', '3.0']
ruby-version: [ '2.5', '2.6', '2.7', '3.0', '3.1']

steps:
- uses: actions/checkout@v2
Expand All @@ -28,10 +28,10 @@ jobs:
# Those are only run with the latest supported version
# Make sure to update the `if` when changing supported versions
- name: Profile Memory Allocation
if: matrix.ruby-version == '3.0'
if: matrix.ruby-version == '3.1'
run: bundle exec rake check:memory
- name: Interpreter Warnings Test
if: matrix.ruby-version == '3.0'
if: matrix.ruby-version == '3.1'
env:
RUBYOPT: '-w'
run: bundle exec rake check:specs
12 changes: 4 additions & 8 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.0
TargetRubyVersion: 2.5
DisplayCopNames: true
Exclude:
- "tasks/**/*"
Expand All @@ -17,9 +19,6 @@ Metrics:
Bundler:
Enabled: false

Performance/RedundantBlockCall:
Enabled: false

Lint/UselessAssignment:
Enabled: false

Expand All @@ -32,13 +31,10 @@ Lint/UnusedMethodArgument:
Lint/UnusedBlockArgument:
Enabled: false

Lint/EndAlignment:
Enabled: false

Lint/EmptyWhen:
Enabled: false

Lint/UnneededSplatExpansion:
Lint/RedundantSplatExpansion:
Enabled: false

Lint/IneffectiveAccessModifier:
Expand Down
142 changes: 142 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-01-26 19:45:20 UTC using RuboCop version 1.11.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'rouge.gemspec'

# Offense count: 8
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/formatters/html_spec.rb'
- 'spec/lexer_spec.rb'
- 'spec/theme_spec.rb'

# Offense count: 27
Lint/MissingSuper:
Enabled: false

# Offense count: 2
Lint/MixedRegexpCaptureTypes:
Exclude:
- 'lib/rouge/lexers/elixir.rb'
- 'lib/rouge/lexers/lasso.rb'

# Offense count: 4
Lint/NestedPercentLiteral:
Exclude:
- 'lib/rouge/lexers/hylang.rb'
- 'lib/rouge/lexers/janet.rb'
- 'lib/rouge/lexers/powershell.rb'
- 'spec/lexers/j_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Lint/NonDeterministicRequireOrder:
Exclude:
- 'spec/spec_helper.rb'

# Offense count: 1
Lint/OutOfRangeRegexpRef:
Exclude:
- 'lib/rouge/tex_theme_renderer.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
Lint/UselessAccessModifier:
Exclude:
- 'lib/rouge/cli.rb'

# Offense count: 1
Naming/AccessorMethodName:
Exclude:
- 'lib/rouge/theme.rb'

# Offense count: 43
Naming/ConstantName:
Exclude:
- 'lib/rouge/lexers/eiffel.rb'
- 'lib/rouge/themes/gruvbox.rb'

# Offense count: 21
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: lowercase, uppercase
Naming/HeredocDelimiterCase:
Exclude:
- 'rouge.gemspec'
- 'spec/lexers/diff_spec.rb'
- 'spec/lexers/haml_spec.rb'
- 'spec/lexers/html_spec.rb'
- 'spec/lexers/mason_spec.rb'
- 'spec/lexers/matlab_spec.rb'
- 'spec/lexers/shell_spec.rb'
- 'spec/plugins/redcarpet_spec.rb'
- 'spec/theme_spec.rb'
- 'spec/visual_spec.rb'

# Offense count: 4
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/rouge/tex_theme_renderer.rb'
- 'spec/lexers/swift_spec.rb'

# Offense count: 8
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Naming/MemoizedInstanceVariableName:
Exclude:
- 'lib/rouge/lexers/cython.rb'
- 'lib/rouge/lexers/freefem.rb'
- 'lib/rouge/lexers/hack.rb'
- 'lib/rouge/lexers/python.rb'
- 'lib/rouge/lexers/verilog.rb'
- 'lib/rouge/lexers/yang.rb'

# Offense count: 16
# Configuration parameters: EnforcedStyle, IgnoredPatterns.
# SupportedStyles: snake_case, camelCase
Naming/MethodName:
Exclude:
- 'lib/rouge/lexers/igorpro.rb'
- 'lib/rouge/lexers/xpath.rb'

# Offense count: 68
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Enabled: false

# Offense count: 40
# Configuration parameters: EnforcedStyle, AllowedIdentifiers.
# SupportedStyles: snake_case, camelCase
Naming/VariableName:
Exclude:
- 'lib/rouge/lexers/brightscript.rb'
- 'lib/rouge/lexers/dafny.rb'
- 'lib/rouge/lexers/freefem.rb'
- 'lib/rouge/lexers/igorpro.rb'
- 'lib/rouge/lexers/kotlin.rb'
- 'lib/rouge/lexers/xpath.rb'

# Offense count: 5
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
Naming/VariableNumber:
Exclude:
- 'lib/rouge/lexers/c.rb'
- 'lib/rouge/themes/gruvbox.rb'
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ gem 'minitest-power_assert'
gem 'power_assert', '~> 1.2'

gem 'parallel', '~> 1.13.0' if RUBY_VERSION < '2.2.0'
gem 'rubocop', '~> 0.49.1'
gem 'rubocop', '~> 1.0', '<= 1.11'
gem 'rubocop-performance'

# don't try to install redcarpet under jruby
gem 'redcarpet', :platforms => :ruby
Expand Down

0 comments on commit 067881e

Please sign in to comment.