Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: Danger
on: [pull_request]

on:
pull_request:
types: [opened, reopened, edited, synchronize]

jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: |
# Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
uses: numbata/danger-pr-comment/.github/workflows/[email protected]
secrets: inherit
with:
ruby-version: '3.4'
bundler-cache: true
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: '3.4'
bundler-cache: true
- run: bundle exec rubocop
24 changes: 10 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@ jobs:
fail-fast: false
matrix:
entry:
- { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '5' }
- { ruby: '3.1.7', mongo: 'mongo:4.4', mongoid: '5' }
# - { ruby: 'jruby-9.1.17.0', mongo: 'mongo:4.4', mongoid: '5' }
- { ruby: 'jruby-9.4.13.0', mongo: 'mongo:4.4', mongoid: '5' }
- { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '6' }
- { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '6' }
- { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '6' }
- { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '6' }
- { ruby: '3.1.7', mongo: 'mongo:4.4', mongoid: '6' }
- { ruby: '3.4.8', mongo: 'mongo:4.4', mongoid: '6' }
- { ruby: 'jruby-9.4.13.0', mongo: 'mongo:4.4', mongoid: '6' }
- { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '7', coverage: 'true' }
- { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '7' }
- { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '7' }
- { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '7' }
- { ruby: '3.1.7', mongo: 'mongo:4.4', mongoid: '7', coverage: 'true' }
- { ruby: '3.4.8', mongo: 'mongo:4.4', mongoid: '7' }
# - { ruby: 'jruby-9.4.13.0', mongo: 'mongo:4.4', mongoid: '7' }
- { ruby: '2.6.6', mongo: 'mongo:6.0', mongoid: '8' }
- { ruby: '2.7.1', mongo: 'mongo:7.0', mongoid: '8' }
- { ruby: '3.0.5', mongo: 'mongo:6.0', mongoid: '8' }
- { ruby: '3.1.3', mongo: 'mongo:7.0', mongoid: '8' }
- { ruby: '3.1.3', mongo: 'mongo:8.0', mongoid: '9' }
- { ruby: '3.1.7', mongo: 'mongo:6.0', mongoid: '8' }
- { ruby: '3.4.8', mongo: 'mongo:7.0', mongoid: '8' }
- { ruby: '3.4.8', mongo: 'mongo:8.0', mongoid: '9' }
- { ruby: '4.0.0', mongo: 'mongo:7.0', mongoid: '8' }
- { ruby: '4.0.0', mongo: 'mongo:8.0', mongoid: '9' }
# - { ruby: 'jruby-9.4.13.0', mongo: 'mongo:8.0', mongoid: '8' }
experimental: [false]

Expand Down
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--require spec_helper
--format documentation
8 changes: 7 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
AllCops:
SuggestExtensions: true
NewCops: enable

Lint/RaiseException:
Enabled: true

Expand All @@ -21,4 +25,6 @@ RSpec/LeakyConstantDeclaration:

inherit_from: .rubocop_todo.yml

require: rubocop-rspec
plugins:
- rubocop-rspec
- rubocop-rake
146 changes: 107 additions & 39 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,182 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-04-07 15:05:45 -0400 using RuboCop version 0.81.0.
# on 2025-12-31 23:55:39 UTC using RuboCop version 1.81.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.

# Offense count: 3
# Configuration parameters: Include.
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
Bundler/DuplicatedGem:
# Offense count: 1
# Configuration parameters: Severity.
Gemspec/RequiredRubyVersion:
Exclude:
- 'Gemfile'
- 'mongoid-locker.gemspec'

# Offense count: 4
# Configuration parameters: IgnoredMethods.
Metrics/AbcSize:
Max: 24
# Offense count: 6
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/support/configurations_shared_context.rb'
- 'spec/test_examples_spec.rb'

# Offense count: 11
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 290
# Offense count: 8
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'spec/support/locker_is_included_shared_examples.rb'

# Offense count: 5
# Configuration parameters: CountComments, ExcludedMethods.
# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 27

# Offense count: 6
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 31

# Offense count: 1
# Configuration parameters: CountComments.
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 105
Max: 109

# Offense count: 2
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'Rakefile.rb'
- 'lib/mongoid-locker.rb'
- 'spec/mongoid-locker_spec.rb'

# Offense count: 1
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_
# ForbiddenPrefixes: is_, has_, have_
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
# AllowedMethods: call
# WaywardPredicates: nonzero?
Naming/PredicateMethod:
Exclude:
- 'lib/mongoid/locker/wrapper.rb'

# Offense count: 1
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
# NamePrefix: is_, has_, have_, does_
# ForbiddenPrefixes: is_, has_, have_, does_
# AllowedMethods: is_a?
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicateName:
Naming/PredicatePrefix:
Exclude:
- 'spec/**/*'
- 'lib/mongoid/locker.rb'

# Offense count: 2
RSpec/BeforeAfterAll:
Exclude:
- 'spec/spec_helper.rb'
- 'spec/rails_helper.rb'
- 'spec/support/**/*.rb'
- '**/spec/spec_helper.rb'
- '**/spec/rails_helper.rb'
- '**/spec/support/**/*.rb'
- 'spec/test_examples_spec.rb'

# Offense count: 1
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- '**/spec/features/**/*'
- '**/spec/requests/**/*'
- '**/spec/routing/**/*'
- '**/spec/system/**/*'
- '**/spec/views/**/*'
- 'spec/test_examples_spec.rb'

# Offense count: 8
# Configuration parameters: Max.
# Offense count: 9
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 11

# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/IncludeExamples:
Exclude:
- 'spec/mongoid-locker_spec.rb'
- 'spec/support/locker_is_included_shared_examples.rb'
- 'spec/test_examples_spec.rb'
- 'spec/support/locker_methods_shared_examples.rb'

# Offense count: 1
# Configuration parameters: CustomTransform, IgnoreMethods.
RSpec/FilePath:
# Offense count: 2
RSpec/LetSetup:
Exclude:
- 'spec/mongoid-locker_spec.rb'
- 'spec/support/populate_database_shared_context.rb'

# Offense count: 12
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 12
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 10

# Offense count: 2
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Exclude:
- 'spec/support/locker_is_included_shared_examples.rb'

# Offense count: 1
RSpec/RemoveConst:
Exclude:
- 'spec/support/locker_helpers.rb'

# Offense count: 1
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
# SupportedInflectors: default, active_support
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/mongoid-locker_spec.rb'

# Offense count: 1
RSpec/SubjectStub:
Exclude:
- 'spec/support/delegated_methods_shared_examples.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CollectionQuerying:
Exclude:
- 'lib/mongoid/locker.rb'

# Offense count: 2
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/mongoid/locker.rb'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSplatArgument.
Style/HashConversion:
Exclude:
- 'spec/support/locker_is_included_shared_examples.rb'
- 'spec/support/locker_methods_shared_examples.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/mongoid/locker.rb'

# Offense count: 35
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 250
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Changelog

### 2.2.1 (Next)
### 2.3.0 (Next)

* [#109](https://github.com/mongoid/mongoid-locker/pull/109): Migrate Danger to use danger-pr-comment workflow - [@dblock](https://github.com/dblock).
* [#109](https://github.com/mongoid/mongoid-locker/pull/109): Remove support for Ruby 2.x - [@dblock](https://github.com/dblock).
* [#109](https://github.com/mongoid/mongoid-locker/pull/109): Add support for Ruby 4.0 - [@dblock](https://github.com/dblock).
* Your contribution here.

### 2.2.0 (2025-06-22)
Expand Down
4 changes: 3 additions & 1 deletion Dangerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

danger.import_dangerfile(gem: 'mongoid-danger')
danger.import_dangerfile(gem: 'danger-pr-comment')

changelog.check!
13 changes: 9 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source 'https://rubygems.org'
gemspec

case ENV['MONGOID_VERSION']
case ENV.fetch('MONGOID_VERSION', nil)
when /^9/
gem 'mongoid', '~> 9.0'
when /^8/
Expand All @@ -27,11 +27,16 @@ end
group :development, :test do
gem 'pry-byebug', platforms: :mri

gem 'bigdecimal', '1.3.5', platforms: :mri
gem 'danger', require: false
gem 'danger-changelog', require: false
gem 'danger-pr-comment', require: false
gem 'mongoid-compatibility'
gem 'mongoid-danger', '~> 0.2.0'
gem 'mongoid-history'
gem 'mutex_m'
gem 'rspec', '~> 3.9'
gem 'rubocop', '0.81.0'
gem 'rubocop-rspec', '1.38.1'
gem 'rubocop', '1.81.1'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'simplecov', require: false
end
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Document-level optimistic locking for MongoDB via Mongoid. Mongoid-Locker is an
**NOTE:** Please refer to [1-x-stable](https://github.com/mongoid/mongoid-locker/tree/1-x-stable) branch for `1.x.x` documentation. See the [UPGRADING](UPGRADING.md) guide and [CHANGELOG](CHANGELOG.md) for an overview of the changes.

[Tested](https://github.com/mongoid/mongoid-locker/actions) against:
- MRI: `2.3.8`, `2.4.7`, `2.5.7`, `2.6.6`, `2.7.1`, `3.0.5`, `3.1.3`
- MRI: `3.x`, `4.x`
- JRuby `9.1.17.0`, `9.2.11.1`
- Mongoid: `5`, `6`, `7`, `8`, `9`

Expand Down
Loading