Skip to content

Commit

Permalink
add rubocop, github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
patodevilla committed Mar 21, 2024
1 parent ba2e205 commit 8d07fc7
Show file tree
Hide file tree
Showing 84 changed files with 1,818 additions and 1,406 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test

on: [pull_request]

# permissions:
# contents: read

jobs:
lint:
runs-on: ubuntu-latest
# env:
# BUNDLE_ONLY: rubocop

steps:
- uses: actions/checkout@v4

- name: Set up Ruby 3.2.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true

- name: Run Tests
run: bundle exec rake
# run: bundle exec rubocop --parallel
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@
/pkg/
/spec/reports/
/tmp/
Gemfile.lock

# Ignore Byebug command history file.
.byebug_history
Gemfile.lock
12 changes: 12 additions & 0 deletions .rubocop-minitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
###########################################################
#################### Rubocop Minitest #####################
###########################################################

Minitest/AssertTruthy:
Enabled: false

Minitest/RefuteFalse:
Enabled: false

Minitest/MultipleAssertions:
Max: 4
68 changes: 68 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# see example at https://gist.github.com/jhass/a5ae80d87f18e53e7b56

# <% unless ENV['BYPASS_RUBOCOP_TODO'] %>
# inherit_from:
# <% else %>
# inherit_from:
# - '.rubocop-todo.yml'
# <% end %>

inherit_from:
- .rubocop_todo.yml
- .rubocop-minitest.yml

require:
- rubocop-minitest
- rubocop-rake
- rubocop-performance

AllCops:
NewCops: enable
TargetRubyVersion: 3.2.2
# TargetRailsVersion: 6.1.4
# Exclude:
# - 'Gemfile.lock'

Naming/VariableNumber:
Enabled: false

Layout/SpaceInsideHashLiteralBraces:
Enabled: false

Layout/EmptyLinesAroundModuleBody:
EnforcedStyle: empty_lines_special
Enabled: false

Layout/TrailingEmptyLines:
Enabled: false
EnforcedStyle: final_blank_line

Layout/EmptyLinesAroundClassBody:
Enabled: false

Style/RaiseArgs:
EnforcedStyle: compact

Layout/CaseIndentation:
EnforcedStyle: end

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Layout/IndentationWidth:
Enabled: false

Layout/EndAlignment:
Enabled: false

Layout/ElseAlignment:
Enabled: false

Style/Lambda:
EnforcedStyle: literal

Layout/FirstHashElementIndentation:
Enabled: false

Performance/RedundantMerge:
Enabled: false
24 changes: 24 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-03-20 20:20:07 UTC using RuboCop version 1.62.1.
# 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.

Style/Documentation:
Enabled: false

Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Metrics/BlockLength:
Enabled: false
20 changes: 17 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
source "https://rubygems.org"
# frozen_string_literal: true

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
source 'https://rubygems.org'

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

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

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

# gem 'bundler', '2.4.22'
gem 'debug', '>= 1.0.0'
gem 'minitest', '~> 5.14'
gem 'minitest-reporters', '~> 1.6'
gem 'rake', '~> 13.1'

# rubocop
gem 'rubocop', '~> 1.62'
gem 'rubocop-minitest', '~> 0.35'
gem 'rubocop-performance', '~> 1.20'
gem 'rubocop-rake', '~> 0.6'
39 changes: 37 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GIT
PATH
remote: .
specs:
json_schema_form (0.15.25)
json_schema_form (0.15.26)
activesupport (~> 6)
dry-schema (~> 1.13)
json_schemer (= 2.1.1)
Expand All @@ -24,6 +24,7 @@ GEM
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
ansi (1.5.0)
ast (2.4.2)
builder (3.2.4)
concurrent-ruby (1.2.2)
debug (1.7.1)
Expand Down Expand Up @@ -61,20 +62,50 @@ GEM
io-console (0.6.0)
irb (1.6.2)
reline (>= 0.3.0)
json (2.7.1)
json_schemer (2.1.1)
hana (~> 1.3)
regexp_parser (~> 2.0)
simpleidn (~> 0.2)
language_server-protocol (3.17.0.3)
minitest (5.14.4)
minitest-reporters (1.6.1)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.5.0)
reline (0.3.2)
io-console (~> 0.5)
rexml (3.2.6)
rubocop (1.62.1)
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 (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-minitest (0.35.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
simpleidn (0.2.1)
unf (~> 0.1.4)
Expand All @@ -83,18 +114,22 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
unicode-display_width (2.5.0)
zeitwerk (2.6.12)

PLATFORMS
ruby

DEPENDENCIES
bundler (= 2.4.22)
debug (>= 1.0.0)
json_schema_form!
minitest (~> 5.14)
minitest-reporters (~> 1.6)
rake (~> 13.1)
rubocop (~> 1.62)
rubocop-minitest (~> 0.35)
rubocop-performance (~> 1.20)
rubocop-rake (~> 0.6)
super_hash (>= 0.2.0)!

BUNDLED WITH
Expand Down
16 changes: 11 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
require "bundler/gem_tasks"
require "rake/testtask"
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList["test/**/*_spec.rb"]
t.verbose = true
t.warning = true
t.libs << 'test'
# t.libs << 'lib'
t.test_files = FileList['test/**/*_test.rb']
end

task :default => :test
require 'rubocop/rake_task'
RuboCop::RakeTask.new

task default: %i[test rubocop]
7 changes: 4 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "json_schema_form"
require 'bundler/setup'
require 'json_schema_form'

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

require "irb"
require 'irb'
IRB.start(__FILE__)
Loading

0 comments on commit 8d07fc7

Please sign in to comment.