Skip to content

Commit 9652c31

Browse files
committed
add rubocop, github actions
1 parent ba2e205 commit 9652c31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1581
-1181
lines changed

.github/workflows/test.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
3+
on: [pull_request]
4+
5+
# permissions:
6+
# contents: read
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
# env:
12+
# BUNDLE_ONLY: rubocop
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Ruby 3.2.2
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: 3.2.2
21+
bundler-cache: true
22+
23+
- name: Run Tests
24+
run: bundle exec rake
25+
# run: bundle exec rubocop --parallel

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,4 @@
66
/pkg/
77
/spec/reports/
88
/tmp/
9-
Gemfile.lock
10-
11-
# Ignore Byebug command history file.
12-
.byebug_history
9+
Gemfile.lock

.rubocop-minitest.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
###########################################################
2+
#################### Rubocop Minitest #####################
3+
###########################################################
4+
5+
Minitest/AssertTruthy:
6+
Enabled: false
7+
8+
Minitest/RefuteFalse:
9+
Enabled: false
10+
11+
Minitest/MultipleAssertions:
12+
Max: 4

.rubocop.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# see example at https://gist.github.com/jhass/a5ae80d87f18e53e7b56
2+
3+
# <% unless ENV['BYPASS_RUBOCOP_TODO'] %>
4+
# inherit_from:
5+
# <% else %>
6+
# inherit_from:
7+
# - '.rubocop-todo.yml'
8+
# <% end %>
9+
10+
inherit_from:
11+
- .rubocop_todo.yml
12+
- .rubocop-minitest.yml
13+
14+
require:
15+
- rubocop-minitest
16+
- rubocop-rake
17+
- rubocop-performance
18+
19+
AllCops:
20+
NewCops: enable
21+
TargetRubyVersion: 3.2.2
22+
# TargetRailsVersion: 6.1.4
23+
# Exclude:
24+
# - 'Gemfile.lock'
25+
26+
Naming/VariableNumber:
27+
Enabled: false
28+
29+
Layout/SpaceInsideHashLiteralBraces:
30+
Enabled: false
31+
32+
Layout/EmptyLinesAroundModuleBody:
33+
EnforcedStyle: empty_lines_special
34+
Enabled: false
35+
36+
Layout/TrailingEmptyLines:
37+
Enabled: false
38+
EnforcedStyle: final_blank_line
39+
40+
Layout/EmptyLinesAroundClassBody:
41+
Enabled: false
42+
43+
Style/RaiseArgs:
44+
EnforcedStyle: compact
45+
46+
Layout/CaseIndentation:
47+
EnforcedStyle: end
48+
49+
Layout/MultilineMethodCallIndentation:
50+
EnforcedStyle: indented
51+
52+
Layout/IndentationWidth:
53+
Enabled: false
54+
55+
Layout/EndAlignment:
56+
Enabled: false
57+
58+
Layout/ElseAlignment:
59+
Enabled: false
60+
61+
Style/Lambda:
62+
EnforcedStyle: literal

.rubocop_todo.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2024-03-20 20:20:07 UTC using RuboCop version 1.62.1.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
Style/Documentation:
10+
Enabled: false
11+
12+
Metrics/AbcSize:
13+
Enabled: false
14+
Metrics/CyclomaticComplexity:
15+
Enabled: false
16+
17+
Metrics/MethodLength:
18+
Enabled: false
19+
20+
Metrics/PerceivedComplexity:
21+
Enabled: false
22+
23+
Metrics/BlockLength:
24+
Enabled: false

Gemfile

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1-
source "https://rubygems.org"
1+
# frozen_string_literal: true
22

3-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3+
source 'https://rubygems.org'
4+
5+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
46

57
gem 'super_hash', '>= 0.2.0', git: 'https://github.com/prysmex/super_hash.git'
68

79
# Specify your gem's dependencies in json_schema_form.gemspec
8-
gemspec
10+
gemspec
11+
12+
# gem 'bundler', '2.4.22'
13+
gem 'debug', '>= 1.0.0'
14+
gem 'minitest', '~> 5.14'
15+
gem 'minitest-reporters', '~> 1.6'
16+
gem 'rake', '~> 13.1'
17+
18+
# rubocop
19+
gem 'rubocop', '~> 1.62'
20+
gem 'rubocop-minitest', '~> 0.35'
21+
gem 'rubocop-performance', '~> 1.20'
22+
gem 'rubocop-rake', '~> 0.6'

Gemfile.lock

+37-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GIT
88
PATH
99
remote: .
1010
specs:
11-
json_schema_form (0.15.25)
11+
json_schema_form (0.15.26)
1212
activesupport (~> 6)
1313
dry-schema (~> 1.13)
1414
json_schemer (= 2.1.1)
@@ -24,6 +24,7 @@ GEM
2424
tzinfo (~> 2.0)
2525
zeitwerk (~> 2.3)
2626
ansi (1.5.0)
27+
ast (2.4.2)
2728
builder (3.2.4)
2829
concurrent-ruby (1.2.2)
2930
debug (1.7.1)
@@ -61,20 +62,50 @@ GEM
6162
io-console (0.6.0)
6263
irb (1.6.2)
6364
reline (>= 0.3.0)
65+
json (2.7.1)
6466
json_schemer (2.1.1)
6567
hana (~> 1.3)
6668
regexp_parser (~> 2.0)
6769
simpleidn (~> 0.2)
70+
language_server-protocol (3.17.0.3)
6871
minitest (5.14.4)
6972
minitest-reporters (1.6.1)
7073
ansi
7174
builder
7275
minitest (>= 5.0)
7376
ruby-progressbar
77+
parallel (1.24.0)
78+
parser (3.3.0.5)
79+
ast (~> 2.4.1)
80+
racc
81+
racc (1.7.3)
82+
rainbow (3.1.1)
7483
rake (13.1.0)
7584
regexp_parser (2.5.0)
7685
reline (0.3.2)
7786
io-console (~> 0.5)
87+
rexml (3.2.6)
88+
rubocop (1.62.1)
89+
json (~> 2.3)
90+
language_server-protocol (>= 3.17.0)
91+
parallel (~> 1.10)
92+
parser (>= 3.3.0.2)
93+
rainbow (>= 2.2.2, < 4.0)
94+
regexp_parser (>= 1.8, < 3.0)
95+
rexml (>= 3.2.5, < 4.0)
96+
rubocop-ast (>= 1.31.1, < 2.0)
97+
ruby-progressbar (~> 1.7)
98+
unicode-display_width (>= 2.4.0, < 3.0)
99+
rubocop-ast (1.31.2)
100+
parser (>= 3.3.0.4)
101+
rubocop-minitest (0.35.0)
102+
rubocop (>= 1.61, < 2.0)
103+
rubocop-ast (>= 1.31.1, < 2.0)
104+
rubocop-performance (1.20.2)
105+
rubocop (>= 1.48.1, < 2.0)
106+
rubocop-ast (>= 1.30.0, < 2.0)
107+
rubocop-rake (0.6.0)
108+
rubocop (~> 1.0)
78109
ruby-progressbar (1.13.0)
79110
simpleidn (0.2.1)
80111
unf (~> 0.1.4)
@@ -83,18 +114,22 @@ GEM
83114
unf (0.1.4)
84115
unf_ext
85116
unf_ext (0.0.9.1)
117+
unicode-display_width (2.5.0)
86118
zeitwerk (2.6.12)
87119

88120
PLATFORMS
89121
ruby
90122

91123
DEPENDENCIES
92-
bundler (= 2.4.22)
93124
debug (>= 1.0.0)
94125
json_schema_form!
95126
minitest (~> 5.14)
96127
minitest-reporters (~> 1.6)
97128
rake (~> 13.1)
129+
rubocop (~> 1.62)
130+
rubocop-minitest (~> 0.35)
131+
rubocop-performance (~> 1.20)
132+
rubocop-rake (~> 0.6)
98133
super_hash (>= 0.2.0)!
99134

100135
BUNDLED WITH

Rakefile

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
require "bundler/gem_tasks"
2-
require "rake/testtask"
1+
# frozen_string_literal: true
2+
3+
require 'bundler/gem_tasks'
4+
require 'rake/testtask'
35

46
Rake::TestTask.new do |t|
5-
t.libs << "test"
6-
t.test_files = FileList["test/**/*_spec.rb"]
77
t.verbose = true
88
t.warning = true
9+
t.libs << 'test'
10+
# t.libs << 'lib'
11+
t.test_files = FileList['test/**/*_test.rb']
912
end
1013

11-
task :default => :test
14+
require 'rubocop/rake_task'
15+
RuboCop::RakeTask.new
16+
17+
task default: %i[test rubocop]

bin/console

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

3-
require "bundler/setup"
4-
require "json_schema_form"
4+
require 'bundler/setup'
5+
require 'json_schema_form'
56

67
# You can add fixtures and/or initialization code here to make experimenting
78
# with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "json_schema_form"
1011
# require "pry"
1112
# Pry.start
1213

13-
require "irb"
14+
require 'irb'
1415
IRB.start(__FILE__)

0 commit comments

Comments
 (0)