Skip to content

Commit a04297d

Browse files
committed
build: integrate Rubocop with the project
1 parent 4d976c4 commit a04297d

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Gemfile.lock
1111
node_modules
1212
package-lock.json
1313
ai-prompt.erb
14+
rubocop-report.json

.rubocop.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
inherit_gem:
2+
main_branch_shared_rubocop_config: config/rubocop.yml
3+
4+
AllCops:
5+
# Pin this project to Ruby 3.1 in case the shared config above is upgraded to 3.2
6+
# or later.
7+
TargetRubyVersion: 3.2

Rakefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ task :test do
1818
end
1919
default_tasks << :test
2020

21+
# Rubocop
22+
23+
require 'rubocop/rake_task'
24+
25+
RuboCop::RakeTask.new
26+
27+
default_tasks << :rubocop
28+
29+
# YARD
30+
2131
unless RUBY_PLATFORM == 'java' || RUBY_ENGINE == 'truffleruby'
2232
#
2333
# YARD documentation for this project can NOT be built with JRuby.
@@ -51,7 +61,7 @@ default_tasks << :build
5161
task default: default_tasks
5262

5363
desc 'Build and install the git gem and run a sanity check'
54-
task :'test:gem' => :install do
64+
task 'test:gem': :install do
5565
output = `ruby -e "require 'git'; g = Git.open('.'); puts g.log.size"`.chomp
5666
raise 'Gem test failed' unless $CHILD_STATUS.success?
5767
raise 'Expected gem test to return an integer' unless output =~ /^\d+$/

git.gemspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ Gem::Specification.new do |spec|
3333
spec.add_runtime_dependency 'rchardet', '~> 1.9'
3434

3535
spec.add_development_dependency 'create_github_release', '~> 2.1'
36+
spec.add_development_dependency 'main_branch_shared_rubocop_config', '~> 0.1'
3637
spec.add_development_dependency 'minitar', '~> 1.0'
3738
spec.add_development_dependency 'mocha', '~> 2.7'
3839
spec.add_development_dependency 'rake', '~> 13.2'
40+
spec.add_development_dependency 'rubocop', '~> 1.77'
41+
3942
spec.add_development_dependency 'test-unit', '~> 3.6'
4043

4144
unless RUBY_PLATFORM == 'java'

0 commit comments

Comments
 (0)