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
44 changes: 38 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name: CI

on: push
on:
push:
branches: [master, main]
pull_request:

jobs:
build:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2']
ruby-version: ['3.3', '3.4', '4.0']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -22,6 +25,35 @@ jobs:

- name: Run tests
run: bundle exec rspec
env:
COVERAGE: 'true'

- name: Run mutant
run: bundle exec mutant run
rubocop:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Run RuboCop
run: bundle exec rubocop

audit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Run bundler-audit
run: bundle exec bundler-audit check --update
9 changes: 0 additions & 9 deletions .pelusa.yml

This file was deleted.

93 changes: 89 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,93 @@
plugins:
- rubocop-performance
- rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 3.3
SuggestExtensions: false
Exclude:
- 'Gemfile'
- 'Gemfile.devtools'
- 'benchmarks/**/*'
- 'ice_nine.gemspec'
- 'vendor/**/*'
- 'Guardfile'

# This codebase favours a very dense, "one class/module per concept" style
# with lots of tiny classes (e.g. lib/ice_nine/freezer/*.rb), so the
# class-level documentation cop is enough; per-file/module-length limits
# below are relaxed to match that style rather than forcing artificial
# splits.
Style/Documentation:
Enabled: true

Style/ClassAndModuleChildren:
Exclude:
- 'spec/**/*_spec.rb'

Metrics/ClassLength:
Max: 100

Metrics/ModuleLength:
Max: 100
Exclude:
- 'spec/**/*'

Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- 'ice_nine.gemspec'

# The library re-opens IceNine::Freezer for each supported Ruby core class,
# so short single-purpose subclasses are idiomatic here, not a smell.
Style/EmptyMethod:
EnforcedStyle: expanded

Layout/LineLength:
Max: 100

RSpec/MultipleMemoizedHelpers:
Enabled: false

RSpec/NestedGroups:
Max: 5

RSpec/ExampleLength:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

# The suite consistently defines a single `subject` per example group and
# references it explicitly for readability in multi-line expectations
# instead of relying on the implicit `is_expected` syntax.
RSpec/NamedSubject:
Enabled: false

# These doubles stand in for arbitrary opaque objects that are only ever
# identity-compared (`be(...)`); there is no real interface to verify them
# against.
RSpec/VerifiedDoubles:
Enabled: false

# element_reader_spec.rb intentionally defines and removes real global
# constants (Hash::Test, Application::User, Mash::State, ...) to exercise
# IceNine::Freezer's name-based constant lookup across namespaces -- that is
# the exact behaviour under test, not a leaky-state accident stub_const
# would paper over.
RSpec/RemoveConst:
Exclude:
- 'spec/unit/ice_nine/freezer/class_methods/element_reader_spec.rb'

RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/unit/ice_nine/freezer/class_methods/element_reader_spec.rb'

RSpec/BeforeAfterAll:
Exclude:
- 'spec/unit/ice_nine/freezer/class_methods/element_reader_spec.rb'

Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/unit/ice_nine/freezer/class_methods/element_reader_spec.rb'

Lint/EmptyClass:
Exclude:
- 'spec/unit/ice_nine/freezer/class_methods/element_reader_spec.rb'
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.6
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Contributing
* Follow this [style guide](https://github.com/dkubb/styleguide).
* Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered.
* Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged.
* Run `bundle exec rake`. This runs the spec suite (with 100% line/branch coverage enforced) and RuboCop, and must pass with no regressions for the code to be merged.
* Send me a pull request. Bonus points for topic branches.
22 changes: 15 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
# encoding: utf-8
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

group :development, :test do
gem 'rspec', '~> 3.8', '>= 3.8.0'
gem 'mutant', github: 'mbj/mutant'
gem 'mutant-rspec', github: 'mbj/mutant'
gem 'rake', '~> 13.2'
gem 'rspec', '~> 3.13'

source 'https://oss:sxCL1o1navkPi2XnGB5WYBrhpY9iKIPL@gem.mutant.dev' do
gem 'mutant-license'
end
# No longer bundled with Ruby by default since 3.4; the numeric freezer
# specs exercise BigDecimal explicitly.
gem 'bigdecimal', '~> 3.1'

gem 'rubocop', '~> 1.75', require: false
gem 'rubocop-performance', '~> 1.24', require: false
gem 'rubocop-rspec', '~> 3.6', require: false

gem 'simplecov', '~> 0.22', require: false
gem 'yard', '~> 0.9', require: false

gem 'bundler-audit', '~> 0.9', require: false
end
72 changes: 0 additions & 72 deletions Gemfile.devtools

This file was deleted.

24 changes: 0 additions & 24 deletions Guardfile

This file was deleted.

25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ Deep freeze ruby objects

[![Gem Version](https://badge.fury.io/rb/ice_nine.svg)][gem]
[![Build Status](https://github.com/dkubb/ice_nine/actions/workflows/ci.yml/badge.svg)][ci]
[![Code Climate](https://codeclimate.com/github/dkubb/ice_nine.png)][codeclimate]
[![Inline docs](http://inch-ci.org/github/dkubb/ice_nine.svg?branch=master)][inch]

[gem]: https://rubygems.org/gems/ice_nine
[ci]: https://github.com/dkubb/ice_nine/actions/
[travis]: https://travis-ci.org/dkubb/ice_nine
[gemnasium]: https://gemnasium.com/dkubb/ice_nine
[codeclimate]: https://codeclimate.com/github/dkubb/ice_nine
[inch]: http://inch-ci.org/github/dkubb/ice_nine

Examples
--------
Expand All @@ -40,6 +34,25 @@ object = Object.new
object.deep_freeze
```

Requirements
------------

ice_nine requires Ruby 3.3 or newer, and is tested against Ruby 3.3, 3.4
and 4.0.

Development
-----------

```shell
bundle install
bundle exec rake # runs the spec suite and RuboCop
bundle exec rspec # spec suite only
bundle exec rubocop # lint only
```

Set `COVERAGE=true` when running the spec suite to generate a SimpleCov
report under `coverage/`; the suite enforces 100% line and branch coverage.

Contributing
------------

Expand Down
16 changes: 14 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# encoding: utf-8
# frozen_string_literal: true

Rake.application.load_imports
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)
rescue LoadError
nil
end

task default: %i[spec rubocop]
Loading