Skip to content
Merged
16 changes: 7 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
name: coverage
name: Coverage

on: [push]

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -10,12 +12,8 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- uses: amancevice/setup-code-climate@v0
with:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
- run: cc-test-reporter before-build
bundler-cache: true
- name: Build and test with RSpec
run: |
bundle install --jobs 4 --retry 3
bundle exec rspec
- run: cc-test-reporter after-build
run: bundle exec rspec
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/danger-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Danger Comment

on:
workflow_run:
workflows: [Danger]
types: [completed]

jobs:
comment:
uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@main
secrets: inherit
25 changes: 8 additions & 17 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
---
name: danger
name: Danger

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

jobs:
danger:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Run Danger
run: |
# the personal token is public, this is ok, base64 encode to avoid tripping Github
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@main
secrets: inherit
with:
ruby-version: '3.1'
bundler-cache: true
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Lint

on: [push, pull_request]

jobs:
rubocop:
name: RuboCop
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
name: test
name: Test

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -12,6 +14,7 @@ jobs:
- { ruby: '3.0', allowed-failure: false }
- { ruby: '3.1', allowed-failure: false }
- { ruby: '3.2', allowed-failure: false }
- { ruby: '4.0', allowed-failure: false }
- { ruby: 'ruby-head', allowed-failure: true }
- { ruby: 'truffleruby-head', allowed-failure: true }
- { ruby: 'jruby-head', allowed-failure: true }
Expand All @@ -21,7 +24,7 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby }}
- run: bundle install --jobs=3 --retry=3 --path=vendor/bundle
- run: bundle install --jobs=3 --retry=3
- run: bundle exec rake spec
continue-on-error: ${{ matrix.entry.allowed-failure }}
- name: Specs for when the i18n gem is not available
Expand Down
34 changes: 29 additions & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
require:
- rubocop-rake
- rubocop-rspec

AllCops:
TargetRubyVersion: 2.7
NewCops: enable
Expand All @@ -15,7 +11,7 @@ Metrics/BlockLength:
RSpec/SpecFilePathFormat:
Enabled: false

RSpec/FilePath:
Style/LineLength:
Enabled: false

Style/HashEachMethods:
Expand All @@ -27,4 +23,32 @@ Style/HashTransformKeys:
Style/HashTransformValues:
Enabled: true

Naming/FileName:
Enabled: false

Style/Documentation:
Enabled: false

Naming/MethodParameterName:
Enabled: false

RSpec/NestedGroups:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

Lint/ConstantDefinitionInBlock:
Enabled: false

RSpec/LeakyConstantDeclaration:
Enabled: false

inherit_from: .rubocop_todo.yml

plugins:
- rubocop-rake
- rubocop-rspec
67 changes: 1 addition & 66 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,7 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-02-14 01:34:25 UTC using RuboCop version 1.45.1.
# on 2025-12-30 16:44:41 UTC using RuboCop version 1.82.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: 4
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/ruby-enum/enum_spec.rb'

# Offense count: 1
# 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:
- 'lib/ruby-enum.rb'

# Offense count: 6
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/ruby-enum/enum.rb'

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

# Offense count: 4
RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/ruby-enum/enum_spec.rb'

# Offense count: 6
RSpec/MultipleExpectations:
Max: 11

# Offense count: 18
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/ruby-enum/enum_spec.rb'

# Offense count: 1
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 4

# Offense count: 4
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/ruby-enum/enum.rb'
- 'lib/ruby-enum/errors/base.rb'
- 'lib/ruby-enum/errors/uninitialized_constant_error.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 148
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### 1.0.1 (Next)
### 1.1.0 (Next)

* [#54](https://github.com/dblock/ruby-enum/pull/54): Add support for Ruby 4.0 - [@dblock](https://github.com/dblock).
* [#53](https://github.com/dblock/ruby-enum/pull/53): Replace code climate with coveralls - [@dblock](https://github.com/dblock).
* Your contribution here.

### 1.0.0 (2023/01/10)
Expand Down
2 changes: 2 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# frozen_string_literal: true

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

changelog.check!
toc.check!
11 changes: 6 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ gem 'rake'

group :development, :test do
gem 'danger'
gem 'danger-changelog', '0.6.1'
gem 'danger-toc', '0.2.0'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.0'
gem 'danger-changelog'
gem 'danger-pr-comment'
gem 'danger-toc'
gem 'rspec'
gem 'rubocop', '1.82.1'
gem 'rubocop-rake'
gem 'rubocop-rspec'
end

group :test do
gem 'simplecov', require: false
gem 'coveralls_reborn', require: false
end
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Ruby::Enum
==========

[![Gem Version](http://img.shields.io/gem/v/ruby-enum.svg)](http://badge.fury.io/rb/ruby-enum)
[![Build Status](https://github.com/dblock/ruby-enum/workflows/test/badge.svg?branch=master)](https://github.com/dblock/ruby-enum/actions)
[![Code Climate](https://codeclimate.com/github/dblock/ruby-enum.svg)](https://codeclimate.com/github/dblock/ruby-enum)
[![Test](https://github.com/dblock/ruby-enum/actions/workflows/test.yml/badge.svg)](https://github.com/dblock/ruby-enum/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/dblock/ruby-enum/badge.svg?branch=master)](https://coveralls.io/github/dblock/ruby-enum?branch=master)

Enum-like behavior for Ruby, heavily inspired by [this](http://www.rubyfleebie.com/enumerations-and-ruby), and improved upon [another blog post](http://code.dblock.org/how-to-define-enums-in-ruby).

Expand Down
4 changes: 2 additions & 2 deletions lib/ruby-enum/errors/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def compose_message(key, attributes = {})
"\nSummary:\n #{@summary}" + "\nResolution:\n #{@resolution}"
end

private

BASE_KEY = 'ruby.enum.errors.messages' # :nodoc:

private

# Given the key of the specific error and the options hash, translate the
# message.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby-enum/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Ruby
module Enum
VERSION = '1.0.1'
VERSION = '1.1.0'
end
end
Loading
Loading