Skip to content

Commit

Permalink
Merge pull request #608 from ksss/rubocop-on-rbs
Browse files Browse the repository at this point in the history
Introduce rubocop-on-rbs
  • Loading branch information
ksss authored Dec 24, 2024
2 parents f4499b1 + 7dea2db commit 7a0046f
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: RuboCop

on:
push:
branches:
- main
pull_request: {}

jobs:
rubocop:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: 'Install dependencies'
run: 'bundle install'
- name: 'Run RuboCop'
run: 'bundle exec rubocop --format github'
30 changes: 30 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# The behavior of RuboCop can be controlled via the .rubocop.yml
# configuration file. It makes it possible to enable/disable
# certain cops (checks) and to alter their behavior if they accept
# any parameters. The file can be placed either in your home
# directory or in some project directory.
#
# RuboCop will start looking for the configuration file in the directory
# where the inspected file is and continue its way up to the root directory.
#
# See https://docs.rubocop.org/rubocop/configuration
require:
- rubocop-on-rbs

AllCops:
TargetRubyVersion: 3.3
NewCops: disable
DisabledByDefault: true
Exclude:
- "**/Steepfile"
- "**/*.rb"
- "**/vendor/**/*"

RBS:
Enabled: true
RBS/Layout:
Enabled: false
RBS/Lint:
Enabled: false
RBS/Style:
Enabled: false
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ gem "rbs"
gem "steep"
gem "typeprof"
gem "rake"
gem 'rubocop-on-rbs'
21 changes: 21 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ GEM
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.1)
minitest (5.25.1)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
Expand All @@ -41,6 +42,24 @@ GEM
ffi (~> 1.0)
rbs (3.6.1)
logger
regexp_parser (2.9.2)
rubocop (1.67.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-on-rbs (1.1.0)
rbs (~> 3.5)
rubocop (~> 1.61)
zlib
ruby-progressbar (1.13.0)
securerandom (0.3.1)
steep (1.8.3)
activesupport (>= 5.1)
Expand All @@ -65,13 +84,15 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
zlib (3.1.1)

PLATFORMS
ruby

DEPENDENCIES
rake
rbs
rubocop-on-rbs
steep
typeprof

Expand Down
22 changes: 22 additions & 0 deletions bin/init_new_gem
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,28 @@ put base / 'manifest.yaml', <<~'YAML'
# - name: pathname
YAML

put base.parent / '.rubocop.yml', <<~'YAML'
# This configuration inherits from /.rubocop.yml.
# You can configure RBS style of this gem.
# This file is used on CI. It is configured to automatically
# make rubocop suggestions on pull requests for this gem.
# If you do not like the style enforcement, you should remove this file.
inherit_from: ../../.rubocop.yml
##
# If you want to customize the style, please consult with the gem reviewers.
# You can see the list of cops at https://github.com/ksss/rubocop-on-rbs/blob/main/docs/modules/ROOT/pages/cops.adoc
RBS/Layout:
Enabled: true
RBS/Lint:
Enabled: true
RBS/Style:
Enabled: true
YAML

if github_account
github_account = github_account.sub('@', '')
put base.parent / '_reviewers.yaml', <<~YAML
Expand Down

0 comments on commit 7a0046f

Please sign in to comment.