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

Rubocop::Ruby25

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 real reasons for not following SemVer, but if you've found this project their reasons likely weigh less, in your context (e.g. running rubocop from command line), than what brought you here.

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) way that aligns with the the desired minimum compatible/supported Ruby version.

Ruby Version Support Matrix

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.

rubocop-ruby2_5 (this gem) will install on any version of Ruby >= 2.5, and can be used to analyze code intended to support Ruby >= 2.5.

  • 🧊 - Install on Ruby <version>
  • 🏃‍ - Will Execute on Ruby <version>
  • 🪷 - Will not execute correctly on Ruby <version>
  • 🛠 - Lint code with Ruby <version> syntax as the target
gem 1.8.7 1.9.3 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 3.1 ruby-head jruby-head
rubocop-ruby1_9 🛠 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🪷 🧊 🪷 🧊 🪷
rubocop-ruby2_0 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🪷 🧊 🪷 🧊 🪷
rubocop-ruby2_1 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🪷 🧊 🪷 🧊 🪷
rubocop-ruby2_2 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊‍ 🪷 🧊 🪷 🧊 🪷 🧊 🪷
rubocop-ruby2_3 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🪷 🧊 🪷 🧊 🪷
rubocop-ruby2_4 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🪷 🧊 🪷 🧊 🪷
rubocop-ruby2_5 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🪷
rubocop-ruby2_6 🛠 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🪷
rubocop-ruby2_7 🛠 🛠 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍
rubocop-ruby3_0 🛠 🛠 🛠 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍ 🧊 🏃‍
rubocop-ruby3_1 🛠 🛠 🛠 🛠 🧊 🏃‍ 🛠 🧊 🏃‍ 🧊 🏃‍

🗿 Stable

All releases of this gem are stable releases. The first version is 1.0.0.

✨ Installation

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

$ bundle add rubocop-ruby2_5 -r false

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

$ gem install rubocop-ruby2_5

🔧 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-ruby2_5: 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: 2.5
  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. 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. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

⚡️ 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-ruby2_5) See [docs/images/logo/README.txt][project-logos]
Organization Logo (rubocop-semver) Author: [Yusuf Evli][org-logo-author] Source: [Unsplash][org-logo-source] License: [Unsplash License][org-logo-license]

🤝 Code of Conduct

Everyone interacting in the Rubocop::Ruby25 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-ruby2_5", "~> 1.0"