Skip to content

rubocop-lts/standard-rubocop-lts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

🦾 Standard::Rubocop::Lts Ruby Code Style

Version License: MIT Downloads Rank Open Source Helpers Depfu CodeCov Test Coverage Coveralls Test Coverage CodeClimate Test Coverage Maintainability CI Heads CI Current CI Supported CI Test Coverage CI Style CI Dog Food


Liberapay Patrons Sponsor Me on Github Buy me a coffee Donate on Polar Donate to my FLOSS or refugee efforts at ko-fi.com Donate to my FLOSS or refugee efforts using Patreon

Extended standard (Standard Ruby) config shims for any and every version of Ruby, back to Ruby version 1.8. Enables Ruby projects to more confidently support even the most finely-aged Rubies. Part of the rubocop-lts gem family.

Use the rules standard gives you, and then add more, to increase your code's compatibility across multiple versions of Ruby.

Only reach as far back as you need to go!


The RuboCop LTS family of gems is the distillation of 20+ years of my own Ruby expertise and source code diving, built on the shoulders of the expertise of many others; organizing that expertise into per-Ruby-version sets of configurations.

Although the situation has improved somewhat, it remains unsafe to upgrade RuboCop, or Standard, in a project that supports EOL Rubies.

I hope it helps others avoid some of the challenges I've had with library maintenance, and supporting decade-old mission-critical applications.

Avoid bike-shedding, use rubocop-lts in every project, and let it manage your linting complexity!

If the rubocop-lts stack of libraries has helped you, or your organization, please support my efforts by making a donation, or becoming a sponsor.

πŸ‘ͺ A Gem Family

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

Only two of them sit at the top level, and this gem is not one of them.

Gem Name Version Downloads Activity
rubocop-lts Gem Version Total DL DL Rank Current
rubocop-lts-rspec Gem Version Total DL DL Rank Current
Nested Dependencies

Love linting?

Add a badge to your project's README.md!

Ruby Code Style

[![Ruby Code Style](https://img.shields.io/badge/code_style-rubocop--lts-brightgreen.svg?style=for-the-badge&logo=ruby&logoColor=white)](https://github.com/rubocop-lts/rubocop-lts)

Ruby Code Style

[![Ruby Code Style](https://img.shields.io/badge/code_style-rubocop--lts-brightgreen.svg?style=plastic&logo=ruby&logoColor=white)](https://github.com/rubocop-lts/rubocop-lts)

πŸ—Ώ Stable

All releases of this gem are stable releases. We do not release new versions for every release of rubocop, as this gem is part of rubocop-lts, which is tied to standard (Standard Ruby). Eventually analysis support for an old version of Ruby will no longer be sustainable. When that happens releases of the rubocop-lts gem for that version of Ruby will (mostly) cease. For now though, in Q2 2025, RuboCop, via RuboCop-LTS, can still be used with code targeting Ruby v1.8.7, and newer.

πŸ’‘ Info you can shake a stick at

Tokens to Remember Gem name Gem namespace
Works with MRI Ruby 3.2+ Ruby 3.2 Compat Ruby 3.3 Compat Ruby 3.4 Compat Ruby HEAD Compat
Source Source on GitLab.com Source on Github.com The best SHA: dQw4w9WgXcQ!
Documentation Current release on RubyDoc.info HEAD on RubyDoc.info BDFL Blog Wiki
Compliance License: MIT πŸ“„ilo-declaration-img Security Policy Enforced Code Style CodeQL Contributor Covenant 2.1 SemVer 2.0.0 Keep-A-Changelog 1.0.0 Gitmoji Commits
Expert 1:1 Support Get help from me on Upwork or Get help from me on Codementor
Enterprise Support Get help from me on Tidelift
πŸ’‘Subscribe for support guarantees covering all FLOSS dependencies!
πŸ’‘Tidelift is part of Sonar!
πŸ’‘Tidelift pays maintainers to maintain the software you depend on!
πŸ“Š@Pointy Haired Boss: An enterprise support subscription is "never gonna let you down", and supports open source maintainers!
Comrade BDFL πŸŽ–οΈ Follow Me on LinkedIn Follow Me on Ruby.Social Follow Me on Bluesky Contact BDFL My technical writing
... πŸ’– Find Me on WellFound: Find Me on CrunchBase My LinkTree More About Me 🧊 πŸ™ πŸ›– πŸ§ͺ

✨ Installation

In case you missed it above - you may be better off not depending on this gem directly. See rubocop-lts which sits as a higher level than, and depends on, this gem. It will enable your Ruby style rules to keep pace with whatever version of Ruby your project happens to be on!

If, OTOH, you want to use this gem directly, carry on!

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

$ bundle add standard-rubocop-lts

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

$ gem install standard-rubocop-lts

πŸ”’ Secure Installation

standard-rubocop-lts is cryptographically signed, and has verifiable SHA-256 and SHA-512 checksums by stone_checksums. Be sure the gem you install hasn’t been tampered with by following the instructions below.

Add my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:

gem cert --add <(curl -Ls https://raw.github.com/rubocop-lts/standard-rubocop-lts/main/certs/pboling.pem)

You only need to do that once. Then proceed to install with:

gem install standard-rubocop-lts -P MediumSecurity

The MediumSecurity trust profile will verify signed gems, but allow the installation of unsigned dependencies.

This is necessary because not all of standard-rubocop-lts’s dependencies are signed, so we cannot use HighSecurity.

If you want to up your security game full-time:

bundle config set --global trust-policy MediumSecurity

NOTE: Be prepared to track down certs for signed gems and add them the same way you added mine.

πŸ”§ Basic Usage

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

inherit_gem:
  # Replace {RUBY_MAJOR_VERSION} with the minimum major version of ruby you want to target.
  # Replace {RUBY_MINOR_VERSION} with the minimum minor version of ruby you want to target.
  standard-rubocop-lts: config/ruby-{RUBY_MAJOR_VERSION}-{RUBY_MINOR_VERSION}.yml
What will this do for me?

Among other settings specific to your chosen minimum version of ruby, the above effectively results in the following config (& more):

# We want the Exclude and Include directives from different
#   config files to get merged, not overwritten
inherit_mode:
  merge:
    - Exclude
    - Include

require:
  - standard-rubocop-lts
  - standard
  - standard-performance
  - standard-custom
  - rubocop-performance

# Load basic rules for this version of Ruby from standard.
# Rules are overridden in a LIFO stack.
# If rubocop-performance is listed first, and standard-performance after it,
#   then rubocop-performance's rules will take precedence.
# This is the opposite of what you might expect.
# Below: standard's rules override rubocop-performance's (mostly disabling rules)
inherit_gem:
  standard: config/ruby-1.8.yml
  standard-performance: config/ruby-1.8.yml
  standard-custom: config/base.yml
  rubocop-performance: config/default.yml

AllCops:
  NewCops: enable

# See:
#   https://github.com/rubocop/rubocop-performance/issues/240
#   https://github.com/rubocop/rubocop-performance/pull/241
Performance/Casecmp:
  Enabled: false

# See: https://github.com/rubocop/rubocop-performance/issues/329#issuecomment-1375527811
Performance/BlockGivenWithExplicitBlock:
  Enabled: false

# See: https://github.com/rubocop/rubocop-performance/issues/329#issuecomment-1451511402
Performance/ArraySemiInfiniteRangeSlice:
  Enabled: false

# See: https://github.com/rubocop/rubocop-performance/issues/329#issuecomment-1451511402
Performance/BigDecimalWithNumericArgument:
  Enabled: false

# See: https://github.com/rubocop/rubocop-performance/issues/329#issuecomment-1451511402
Performance/IoReadlines:
  Enabled: false

# Plus: Ruby-version-specific configs provided by "standard" family of gems
# Plus+: Ruby-version-specific configs that standard does not have

What about TargetRubyVersion?

Instead of directly using this gem, standard-rubocop-lts, use rubocop-lts, which depends on this gem. Then you don't need to worry about it, as it will be configured for you by rubocop-lts.

# NOTE: Picking the right version of rubocop-lts automatically aligns:
#       - gemspec's required_ruby_version
#       - RuboCop's TargetRubyVersion
# e.g. v24 for Ruby >= 3.2.0
gem "rubocop-lts", "~> 24.0", require: false

πŸš€ Release Instructions

See CONTRIBUTING.md.

πŸ” Security

See SECURITY.md.

🀝 Contributing

If you need some ideas of where to help, you could work on adding more code coverage, or if it is already πŸ’― (see below) then check issues, or PRs, or use the gem and think about how it could be better.

We Keep A Changelog so if you make changes, remember to update it.

See CONTRIBUTING.md for more detailed instructions.

Code Coverage

Coverage Graph

πŸͺ‡ Code of Conduct

Everyone interacting in this project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the Contributor Covenant 2.1.

🌈 Contributors

Contributors

Made with contributors-img.

Also see GitLab Contributors: https://gitlab.com/rubocop-lts/standard-rubocop-lts/-/graphs/main

⭐️ Star History

Star History Chart

πŸ“Œ Versioning

This Library adheres 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.

πŸ“Œ Is "Platform Support" part of the public API?

Yes. But I'm obligated to include notes...

SemVer should, but doesn't explicitly, say that dropping support for specific Platforms is a breaking change to an API. It is obvious to many, but not all, and since the spec is silent, the bike shedding is endless.

dropping support for a platform is both obviously and objectively a breaking change

To get a better understanding of how SemVer is intended to work over a project's lifetime, read this article from the creator of SemVer:

As a result of this policy, and the interpretive lens used by the maintainer, you can (and should) specify a dependency on these libraries using the Pessimistic Version Constraint with two digits of precision.

For example:

spec.add_dependency("standard-rubocop-lts", "~> 2.0")

See CHANGELOG.md for list of releases.

πŸ“„ License

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

Project Logos (standard-rubocop-lts)

See docs/images/logo/README.txt

Organization Logo (rubocop-lts)

Β© Copyright

Copyright (c) 2023 - 2025 Peter H. Boling, RailsBling.com Rails Bling

πŸ€‘ One more thing

You made it to the bottom of the page, so perhaps you'll indulge me for another 20 seconds. I maintain many dozens of gems, including this one, because I want Ruby to be a great place for people to solve problems, big and small. Please consider supporting my efforts via the giant yellow link below, or one of the others at the head of this README.

Buy me a latte

About

Extended Standard Ruby Configs for Finely Aged Rubies

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •