Semantically Versioned Rubocop Dependency
  • Ruby 99.1%
  • Shell 0.9%
Find a file
2023-03-17 10:07:01 -06:00
.github 👷 Minimum code coverage == 100% 2022-12-19 23:54:41 -07:00
bin 🚨 RuboCop linting 2023-03-17 08:41:25 -06:00
certs 🔒️ Gem signing key 2022-12-18 02:17:57 -07:00
checksums 🔒 Checksums for release 1.1.2 2023-03-17 09:23:55 -06:00
docs/images ✏️ Fix typo Rubocop => RuboCop 2022-12-18 02:31:15 -07:00
gemfiles 👷 CI updates 2022-12-18 04:29:26 -07:00
lib/rubocop 🔖 Release 1.1.2 2023-03-17 09:11:49 -06:00
sig/rubocop ⬇️ Ruby 3.0 2022-05-01 08:20:30 +07:00
spec 🚨 RuboCop linting 2023-03-17 08:41:25 -06:00
.gitignore 👷 More workflows 2022-12-17 20:08:44 -07:00
.gitlab-ci.yml 👷 Add GitLab CI 2023-03-17 09:09:03 -06:00
.rspec Initial commit 2022-04-30 19:10:18 -06:00
.rubocop.yml 🚨 RuboCop linting 2022-12-18 02:48:48 -07:00
.rubocop_todo.yml 🚨 RuboCop linting 2023-03-17 08:41:25 -06:00
.simplecov 🚨 RuboCop linting 2023-03-17 08:41:25 -06:00
.tool-versions 📌 Commit .tool-versions 2023-03-17 08:29:31 -06:00
CHANGELOG.md 🔖 Release 1.1.2 2023-03-17 09:11:49 -06:00
CODE_OF_CONDUCT.md Initial commit 2022-04-30 19:10:18 -06:00
CONTRIBUTING.md ✏️ Fix URL typo 2023-03-17 10:07:01 -06:00
Gemfile yard needs to be in gemspec 2023-03-17 09:19:02 -06:00
Gemfile.lock 🔖 Release 1.1.2 2023-03-17 09:11:49 -06:00
LICENSE.txt 📄 Update Copyright Years 2023-03-17 08:49:05 -06:00
Rakefile 🚨 RuboCop linting 2023-03-17 08:41:25 -06:00
README.md 📝 Development documentation 2023-03-17 08:58:15 -06:00
rubocop-ruby3_0.gemspec yard needs to be in gemspec 2023-03-17 09:19:02 -06:00
rubocop.yml yard needs to be in gemspec 2023-03-17 09:19:02 -06:00
SECURITY.md 🎨 Switch to unicode emoji 2022-12-18 04:29:44 -07:00

SVG RuboCop Logo, Copyright (c) 2014 Dimiter Petrov, CC BY-NC 4.0, see docs/images/logo/README.txt SVG RuboCop Logo, Copyright (c) 2014 Dimiter Petrov, CC BY-NC 4.0, see docs/images/logo/README.txt Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5, see docs/images/logo/README.txt SemVer.org Logo by @maxhaz, see docs/images/logo/README.txt SemVer.org Logo by @maxhaz, see docs/images/logo/README.txt


NOTE: You might be interested in rubocop-lts which sits as a higher level than this gem, and can keep pace with whatever version of Ruby you happen to be on.

Gem Name Version Downloads CI Activity
rubocop-lts Gem Version Total DL DL Rank Current Open Issues Closed Issues Open PRs Closed PRs
rubocop-ruby3_0 Gem Version Total DL DL Rank Current Heads Open Issues Closed Issues Open PRs Closed PRs

Rubocop::Ruby30

See the intro blog post!

This gem requires no other gems. It depends on rubocop, but does not require 'rubocop'.

Awareness of rubocop's lack of SemVer adherence isn't evenly dispersed in the Ruby community.

The RuboCop team has reasons for not following SemVer.

NOTE: They think they are following SemVer, but their interpretation differs from mine, and seems to differ from the intent of SemVer's creator.

If you need to run rubocop from command line in an older version of Ruby, you've come to the right place.

Explanation of non-SemVer compliance, @bbatsov

The purpose of this gem is to constrain the rubocop dependency of a project in a SemVer compliant (Semantic Versioning, Major Versions are Not Sacred) way that aligns with the the desired minimum compatible/supported Ruby version.

Ruby Version Support

Adding this gem will facilitate the best practice of adding a ~> version constrained rubocop dependency, while minimizing the risk of a rubocop minor / patch upgrade breaking the build. See the official compatibility matrix for rubocop.

Three Guarantees

This gem will install a version of rubocop which will install on (1), run on (2), and analyze code (3) intended to support any version of Ruby >= 2.7.

Any change to any of those three abilities would require a major version bump. Each spring rubocop drops the ability to install and run rubocop on an EOL'd Ruby. Eventually rubocop will drop the ability to analyze code intended to support an EOL'd Ruby, as they already have for Ruby 1.8 and 1.9. When the rubocop team makes any of these changes they only bump the minor version of RuboCop, in violation of SemVer (they disagree). In other words, RuboCop intentionally does not bump the major version when they drop analysis, runtime, or installation support for a given version of Ruby. This is a primary raison d’être for this project. To get a better understanding of how SemVer is intended to work read this article from the creator of SemVer:

A Gem Family

The rubocop-lts series of gems has a version supporting any version of Ruby you need. They can be used as development dependencies for libraries or applications.

🗿 Stable

All releases of this gem are stable releases. We do not release new versions for every release of rubocop. A typical release cycle for a gem in the rubocop-lts family is roughly every six months, though eventually analysis support for an old version of Ruby will be dropped. When that happens releases of the rubocop-lts gem for that version of Ruby will (mostly) cease.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add rubocop-ruby3_0 -r false

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install rubocop-ruby3_0

🔧 Usage

The following is optional. We'll discuss why you might want to do this after you see what it does.

Add to the top of your project's .rubocop.yml configuration file:

inherit_gem:
  rubocop-ruby3_0: rubocop.yml

This has the same effect as you declaring the following in your .rubocop.yml:

AllCops:
  # remove if already present in your `.rubocop.yml` to gain the full benefit of this gem!
  TargetRubyVersion: 3.0
  NewCops: enable

Let's talk about these settings.

TargetRubyVersion

Allowing this gem to manage the target ruby version means you can switch to a different gem within the family when you upgrade to the next version of Ruby, and have nothing else to change. A single line in the Gemfile, and you are done.

NewCops: enable

You may not use this setting in your project yet. Upgrades to the latest RuboCop can include all kinds of changes, including removing support for the version of Ruby your project uses, or adding a cop that may not work with some of your syntax (e.g. some use cases of 'module_function`). Accepting new cops arriving in a new version of RuboCop can feel risky, especially when it doesn't follow SemVer.

But this gem shoehorns rubocop into SemVer... so NewCops is now safe(r)! If you use a dependency greening tool like GitHub's dependabot, or the excellent alternatives depfu, and renovate, then you can see the effect of a minor / major version bumpin your CI Build!

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests w/ coverage, or bin/rake to run tests w/ coverage, and linting. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

️ Contributing

See CONTRIBUTING.md

🌈 Contributors

Contributors

Made with contributors-img.

📄 License

The gem is available as open source under the terms of the MIT License License: MIT. See LICENSE for the official Copyright Notice.

Project Logos (rubocop-ruby3_0)

See docs/images/logo/README.txt

Organization Logo (rubocop-semver)

Author: Yusuf Evli Source: Unsplash License: Unsplash License

🤝 Code of Conduct

Everyone interacting in the Rubocop::Ruby30 project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

📌 Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions.

As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision.

For example:

spec.add_dependency "rubocop-ruby3_0", "~> 1.1"