Skip to content

Commit

Permalink
import and apply inst rubocop config, and update rubocop (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccutrer authored May 4, 2023
1 parent 386ad4c commit 1ba41a9
Show file tree
Hide file tree
Showing 17 changed files with 538 additions and 68 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [3.0, 2.7, 2.6]
ruby-version: [3.0, 2.7]
gemfile: ['gemfiles/rails_6.0.gemfile', 'gemfiles/rails_6.1.gemfile', 'gemfiles/rails_7.0.gemfile']
exclude:
- gemfile: gemfiles/rails_7.0.gemfile
ruby-version: 2.6

services:
postgres:
Expand All @@ -34,20 +31,16 @@ jobs:
- 5432:5432

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
- name: Install dependencies
run: bundle install
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
- name: Run tests
run: bundle exec rake
run: bin/rspec
env:
PGHOST: localhost
PGUSER: postgres
Expand All @@ -57,13 +50,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Install dependencies
run: bundle install
- name: Run rubocop
run: bundle exec rake rubocop
- name: Run RuboCop
run: bin/rubocop
timeout-minutes: 2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/.bundle/
/.byebug_history
/gemfiles/*.lock
/log/
/pkg/
/workflow/
/vendor/
29 changes: 18 additions & 11 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
require:
- rubocop-rake

inherit_gem:
rubocop-inst:
- rubocop.yml
- rubocop-rspec.yml

inherit_mode:
merge:
- Exclude

AllCops:
TargetRubyVersion: 2.6
NewCops: enable
TargetRubyVersion: 2.7
Exclude:
- 'gemfiles/*'
- 'vendor/bundle/**/*'

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/DocumentDynamicEvalDefinition:
Enabled: false

Layout/LineLength:
Max: 120

Naming/FileName:
Exclude:
- lib/activerecord-pg-extensions.rb

Metrics:
RSpec/ContextWording:
Enabled: false
RSpec/FilePath:
Enabled: false
RSpec/VerifiedDoubles:
Enabled: false
49 changes: 31 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ GEM
erubi (1.10.0)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
json (2.6.3)
loofah (2.15.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
method_source (1.0.0)
minitest (5.15.0)
nokogiri (1.13.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.3-x86_64-linux)
racc (~> 1.4)
parallel (1.20.1)
parser (3.0.1.1)
parallel (1.23.0)
parser (3.2.2.1)
ast (~> 2.4.1)
pg (1.2.3)
racc (1.6.0)
Expand All @@ -73,9 +76,9 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.0.0)
rainbow (3.1.1)
rake (13.0.3)
regexp_parser (2.1.1)
regexp_parser (2.8.0)
rexml (3.2.5)
rspec (3.10.0)
rspec-core (~> 3.10.0)
Expand All @@ -90,30 +93,40 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.15.0)
rubocop (1.50.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.5.0, < 2.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.5.0)
parser (>= 3.0.1.1)
rubocop-rake (0.5.1)
rubocop
rubocop-rspec (2.3.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.28.1)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop (~> 1.41)
rubocop-inst (1.0.2)
rubocop (~> 1.50)
rubocop-performance (~> 1.17)
rubocop-performance (1.17.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0)
rubocop-rspec (2.20.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
ruby-progressbar (1.13.0)
thor (1.1.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0)
unicode-display_width (2.4.2)
zeitwerk (2.5.4)

PLATFORMS
arm64-darwin-21
x86_64-darwin-19
x86_64-darwin-20
x86_64-linux
Expand All @@ -125,7 +138,7 @@ DEPENDENCIES
pg (~> 1.2)
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.7)
rubocop-inst (~> 1)
rubocop-rake (~> 0.5)
rubocop-rspec (~> 2.3)

Expand Down
5 changes: 2 additions & 3 deletions activerecord-pg-extensions.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ Gem::Specification.new do |spec|
spec.description = spec.summary
spec.homepage = "https://github.com/instructure/activerecord-pg-extensions"
spec.license = "MIT"
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
spec.required_ruby_version = ">= 2.7"

spec.metadata["changelog_uri"] = "https://github.com/instructure/activerecord-pg-extensions/blob/main/CHANGELOG.md"
spec.metadata["rubygems_mfa_required"] = "true"

spec.files = Dir["lib/**/*"] + ["LICENSE.txt", "README.md", "CHANGELOG.md"]
spec.test_files = Dir["spec/**/*"] + ["config/database.yml"]
spec.require_paths = ["lib"]

spec.add_dependency "activerecord", ">= 6.0", "< 7.1"
Expand All @@ -29,7 +28,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "pg", "~> 1.2"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rubocop", "~> 1.7"
spec.add_development_dependency "rubocop-inst", "~> 1"
spec.add_development_dependency "rubocop-rake", "~> 0.5"
spec.add_development_dependency "rubocop-rspec", "~> 2.3"
end
2 changes: 1 addition & 1 deletion bin/appraisal
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Expand Down
2 changes: 1 addition & 1 deletion bin/rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Expand Down
29 changes: 29 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rspec-core", "rspec")
2 changes: 1 addition & 1 deletion bin/rubocop
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Expand Down
Loading

0 comments on commit 1ba41a9

Please sign in to comment.