Skip to content

Commit ea0fa12

Browse files
committed
chore: upgrade CI and RuboCop configs
1 parent b41aa8f commit ea0fa12

Some content is hidden

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

66 files changed

+178
-120
lines changed

.codeclimate.yml

-7
This file was deleted.

.github/workflows/rspec-jruby.yml

+5-13
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,14 @@ jobs:
1212
env:
1313
BUNDLE_JOBS: 4
1414
BUNDLE_RETRY: 3
15+
BUNDLE_GEMFILE: gemfiles/jruby.gemfile
16+
CI: true
1517
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/cache@v1
18-
with:
19-
path: /home/runner/bundle
20-
key: bundle-${{ hashFiles('**/gemfiles/jruby.gemfile') }}-${{ hashFiles('**/*.gemspec') }}
21-
restore-keys: |
22-
bundle-
18+
- uses: actions/checkout@v3
2319
- uses: ruby/setup-ruby@v1
2420
with:
25-
ruby-version: jruby-9.2.15.0
26-
- name: Bundle install
27-
run: |
28-
bundle config path /home/runner/bundle
29-
bundle config --global gemfile gemfiles/jruby.gemfile
30-
bundle install
21+
ruby-version: jruby
22+
bundler-cache: true
3123
- name: Run RSpec
3224
run: |
3325
bundle exec rspec --force-color

.github/workflows/rspec-truffle.yml

+3-14
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,13 @@ jobs:
1212
env:
1313
BUNDLE_JOBS: 4
1414
BUNDLE_RETRY: 3
15+
CI: true
1516
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/cache@v1
18-
with:
19-
path: /home/runner/bundle
20-
key: bundle-${{ hashFiles('**/Gemfile') }}-${{ hashFiles('**/*.gemspec') }}
21-
restore-keys: |
22-
bundle-
17+
- uses: actions/checkout@v3
2318
- uses: ruby/setup-ruby@v1
2419
with:
25-
ruby-version: truffleruby-head
26-
bundler: 2.2.15
20+
ruby-version: truffleruby
2721
bundler-cache: true
28-
29-
- name: Bundle install
30-
run: |
31-
bundle config path /home/runner/bundle
32-
bundle install
3322
- name: Run RSpec
3423
run: |
3524
bundle exec rspec --force-color

.github/workflows/rspec.yml

+7-18
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,26 @@ jobs:
1212
env:
1313
BUNDLE_JOBS: 4
1414
BUNDLE_RETRY: 3
15+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
16+
CI: true
1517
strategy:
1618
fail-fast: false
1719
matrix:
18-
ruby: [2.7]
20+
ruby: [3.2]
1921
gemfile: ["gemfiles/railsmaster.gemfile"]
2022
include:
21-
- ruby: ruby-head
22-
gemfile: "gemfiles/railsmaster.gemfile"
23+
- ruby: 3.1
24+
gemfile: "Gemfile"
2325
- ruby: 3.0
2426
gemfile: "Gemfile"
2527
- ruby: 2.7
2628
gemfile: "Gemfile"
27-
- ruby: 2.6.5
28-
gemfile: "Gemfile"
2929
steps:
30-
- uses: actions/checkout@v2
31-
- uses: actions/cache@v1
32-
with:
33-
path: /home/runner/bundle
34-
key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
35-
restore-keys: |
36-
bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
30+
- uses: actions/checkout@v3
3731
- uses: ruby/setup-ruby@v1
3832
with:
3933
ruby-version: ${{ matrix.ruby }}
40-
- name: Bundle install
41-
run: |
42-
bundle config path /home/runner/bundle
43-
bundle config --global gemfile ${{ matrix.gemfile }}
44-
bundle install
45-
bundle update
34+
bundler-cache: true
4635
- name: Run RSpec
4736
run: |
4837
bundle exec rspec --force-color

.github/workflows/rubocop.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ on:
99
jobs:
1010
rubocop:
1111
runs-on: ubuntu-latest
12+
env:
13+
BUNDLE_JOBS: 4
14+
BUNDLE_RETRY: 3
15+
BUNDLE_GEMFILE: "gemfiles/rubocop.gemfile"
1216
steps:
1317
- uses: actions/checkout@v2
1418
- uses: ruby/setup-ruby@v1
1519
with:
16-
ruby-version: 2.7
20+
ruby-version: 3.1
21+
bundler-cache: true
1722
- name: Lint Ruby code with RuboCop
1823
run: |
19-
bundle install --jobs 4 --retry 3
2024
bundle exec rubocop

.rubocop.yml

+6-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
require:
2-
# add after moving docs to another tool
3-
- 'standard/cop/block_single_line_braces'
4-
- 'rubocop-md'
2+
- standard
53

64
inherit_gem:
75
standard: config/base.yml
86

97
AllCops:
10-
Exclude:
11-
- 'bin/**/*'
12-
- 'tmp/**/*'
13-
- 'vendor/**/*'
14-
- 'gemfiles/vendor/**/*'
15-
- 'clowne.gemspec'
168
DisplayCopNames: true
9+
SuggestExtensions: false
10+
NewCops: disable
1711
TargetRubyVersion: 2.7
1812

19-
Markdown:
20-
WarnInvalid: true
21-
22-
Lint/Void:
23-
Exclude:
24-
- 'docs/README.md'
25-
- 'README.md'
13+
Style/FrozenStringLiteralComment:
14+
Enabled: true
2615

2716
Lint/ConstantDefinitionInBlock:
2817
Exclude:
29-
- 'spec/**/*'
18+
- 'spec/**/*'

.rufo

-3
This file was deleted.

Gemfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24

35
# Specify your gem's dependencies in clowne.gemspec
46
gemspec
57

6-
gem "pry-byebug", platform: :mri
8+
gem "debug", platform: :mri
79

810
gem "sqlite3", "~> 1.4.2", platform: :ruby
911
gem "activerecord-jdbcsqlite3-adapter", ">= 50.0", "< 70.0", platform: :jruby
1012
gem "jdbc-sqlite3", platform: :jruby
1113

12-
gem "activerecord", ">= 6.0", "< 6.2.0"
14+
gem "activerecord", ">= 6.0"
1315
gem "sequel", ">= 5.0"
1416
gem "simplecov"
1517

18+
eval_gemfile "gemfiles/rubocop.gemfile"
19+
1620
local_gemfile = "Gemfile.local"
1721

1822
if File.exist?(local_gemfile)

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![Gem Version](https://badge.fury.io/rb/clowne.svg)](https://badge.fury.io/rb/clowne)
22
[![Build Status](https://github.com/clowne-rb/clowne/actions/workflows/rspec.yml/badge.svg?branch=master)](https://github.com/clowne-rb/clowne/actions?query=branch%3Amaster+)
3-
[![Maintainability](https://api.codeclimate.com/v1/badges/9143c4f91e9d1d2a4bd1/maintainability)](https://codeclimate.com/github/clowne-rb/clowne/maintainability)
43
[![Docs](https://img.shields.io/badge/docs-link-brightgreen.svg)](https://clowne.evilmartians.io)
54

65
# Clowne
@@ -14,7 +13,6 @@ A flexible gem for cloning your models. Clowne focuses on ease of use and provid
1413
<a href="https://evilmartians.com/">
1514
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
1615

17-
1816
## Installation
1917

2018
To install Clowne with RubyGems:

Rakefile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "bundler/gem_tasks"
24
require "rspec/core/rake_task"
35
require "rubocop/rake_task"

bin/console

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

34
require "bundler/setup"
45
require "clowne"

clowne.gemspec

+24-26
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1-
lib = File.expand_path('lib', __dir__)
2-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3-
require 'clowne/version'
1+
# frozen_string_literal: true
2+
3+
require_relative "lib/clowne/version"
44

55
Gem::Specification.new do |spec|
6-
spec.name = 'clowne'
7-
spec.version = Clowne::VERSION
8-
spec.authors = ['Vladimir Dementyev', 'Sverchkov Nikolay']
9-
10-
11-
spec.summary = 'A flexible gem for cloning your models'
12-
spec.description = 'A flexible gem for cloning your models.'
13-
spec.homepage = 'https://github.com/clowne-rb/clowne'
14-
spec.license = 'MIT'
15-
16-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
17-
f.match(%r{^(test|spec|features)/})
18-
end
6+
spec.name = "clowne"
7+
spec.version = Clowne::VERSION
8+
spec.authors = ["Vladimir Dementyev", "Sverchkov Nikolay"]
9+
10+
11+
spec.summary = "A flexible gem for cloning your models"
12+
spec.description = "A flexible gem for cloning your models."
13+
spec.homepage = "https://github.com/clowne-rb/clowne"
14+
spec.license = "MIT"
15+
16+
spec.required_ruby_version = ">= 2.7.0"
17+
18+
spec.files = Dir.glob("lib/**/*") + %w[README.md LICENSE.txt CHANGELOG.md]
19+
1920
spec.metadata = {
2021
"bug_tracker_uri" => "http://github.com/clowne-rb/clowne/issues",
2122
"changelog_uri" => "https://github.com/clowne-rb/clowne/blob/master/CHANGELOG.md",
2223
"documentation_uri" => "https://clowne.evilmartians.io/",
2324
"homepage_uri" => "https://clowne.evilmartians.io/",
2425
"source_code_uri" => "http://github.com/clowne-rb/clowne"
2526
}
26-
spec.require_paths = ['lib']
27-
28-
spec.add_development_dependency 'bundler', '~> 2.0'
29-
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
30-
spec.add_development_dependency 'rspec', '~> 3.0'
31-
spec.add_development_dependency 'factory_bot', '~> 5'
32-
spec.add_development_dependency 'rubocop', '~> 1.22'
33-
spec.add_development_dependency 'rubocop-md', '~> 1'
34-
spec.add_development_dependency 'rubocop-rspec', '~> 2.5'
35-
spec.add_development_dependency 'standard', '~> 1.4.0'
27+
28+
spec.require_paths = ["lib"]
29+
30+
spec.add_development_dependency "bundler", "~> 2.0"
31+
spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
32+
spec.add_development_dependency "rspec", "~> 3.0"
33+
spec.add_development_dependency "factory_bot", "~> 5"
3634
end

gemfiles/jruby.gemfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
source "https://rubygems.org"
44

5-
gem "activerecord-jdbcsqlite3-adapter", "~> 50.0"
5+
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0"
66
gem "jdbc-sqlite3"
7-
gem "activerecord", "~> 5.0.0"
7+
gem "activerecord", "~> 6.0"
88
gem "sequel", ">= 5.0"
99

1010
gemspec path: ".."

gemfiles/rubocop.gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org" do
4+
gem "standard", "~> 1.28"
5+
end

lib/clowne/adapters/active_record/associations/noop.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Associations
77
class Noop < Base
88
def call(record)
99
warn(
10-
"[Clowne] Reflection #{reflection.class.name} is not supported "\
10+
"[Clowne] Reflection #{reflection.class.name} is not supported " \
1111
"(#{@association_name} for #{@source.class})"
1212
)
1313
record

lib/clowne/adapters/base/association.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def init_scope
5757
def cloner_for(child)
5858
return declaration.clone_with if declaration.clone_with
5959

60-
return child.class.cloner_class if child.class.respond_to?(:cloner_class)
60+
child.class.cloner_class if child.class.respond_to?(:cloner_class)
6161
end
6262

6363
def cloner_options

lib/clowne/ext/record_key.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Clowne
44
module Ext
55
module RecordKey # :nodoc: all
66
def key(record)
7-
id = record.respond_to?(:id) && record.id ? record.id : record.__id__
7+
id = (record.respond_to?(:id) && record.id) ? record.id : record.__id__
88
[record.class.name, id].join("#")
99
end
1010
end

spec/clowne/adapters/active_record/associations/belongs_to_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::ActiveRecord::Associations::BelongsTo,
24
:cleanup, adapter: :active_record do
35
let(:adapter) { Clowne::Adapters::ActiveRecord.new }

spec/clowne/adapters/active_record/associations/has_and_belongs_to_many_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::ActiveRecord::Associations::HABTM, :cleanup, adapter: :active_record do
24
let(:adapter) { Clowne::Adapters::ActiveRecord.new }
35
let(:source) { create(:post, :with_tags, tags_num: 2) }

spec/clowne/adapters/active_record/associations/has_many_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::ActiveRecord::Associations::HasMany, :cleanup, adapter: :active_record do
24
let(:adapter) { Clowne::Adapters::ActiveRecord.new }
35
let(:source) { create(:user, :with_posts, posts_num: 2) }

spec/clowne/adapters/active_record/associations/has_one_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::ActiveRecord::Associations::HasOne, :cleanup, adapter: :active_record do
24
let(:adapter) { Clowne::Adapters::ActiveRecord.new }
35
let(:image) { create(:image, :with_preview_image) }

spec/clowne/adapters/active_record/resolvers/association_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::ActiveRecord::Resolvers::Association do
24
let(:params) { double }
35
let(:record) { double }

spec/clowne/adapters/active_record_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::ActiveRecord do
24
let(:record) { create(:post) }
35

spec/clowne/adapters/base/association_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::Base::Association do
24
describe ".clone_one" do
35
let(:adapter) { double }

spec/clowne/adapters/registry_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::Registry do
24
subject { described_class.new }
35

spec/clowne/adapters/sequel/associations/many_to_many_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::Sequel::Associations::ManyToMany, :cleanup, adapter: :sequel do
24
let(:adapter) { Clowne::Adapters::Sequel.new }
35
let(:source) { create("sequel:post", :with_tags, tags_num: 2) }

spec/clowne/adapters/sequel/associations/one_to_many_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::Sequel::Associations::OneToMany, :cleanup, adapter: :sequel do
24
let(:adapter) { Clowne::Adapters::Sequel.new }
35
let(:source) { create("sequel:user", :with_posts, posts_num: 2) }

spec/clowne/adapters/sequel/associations/one_to_one_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::Sequel::Associations::OneToOne, :cleanup, adapter: :sequel do
24
let(:adapter) { Clowne::Adapters::Sequel.new }
35
let(:post) { create("sequel:post") }

spec/clowne/adapters/sequel/resolvers/association_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
describe Clowne::Adapters::Sequel::Resolvers::Association do
24
let(:adapter) { Clowne::Adapters::Sequel.new }
35
let(:params) { double }

0 commit comments

Comments
 (0)