0.0
No release in over a year
RuboCop cops to check RBS signatures
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0
 Project Readme

RuboCop RBS

Gem Version

RucoCop extension that check RBS signatures.

DISCLAIMER: this extension is an ALPHA version, it could be not 100% stable

Check for:

  • invalid RBS files;
  • missing RBS method signatures;
  • mismatching RBS method signatures arguments.

Please ⭐ if you like it.

Know limitations: some IDEs don't update the RBS cops offenses in real-time when a change is applied because only the .rb files are actively monitored.

Install

  • Add to Gemfile: gem 'rubocop-rbs', '~> 0.1.1' (and execute bundle);
  • Add to .rubocop.yml:
require:
  - rubocop-rbs

Usage

  • Execute rubocop: bundle exec rubocop
  • To skip the cop from some files:
Rbs/MethodSignature:
  Exclude:
    - main.rb

Offenses

  • Rbs/MethodSignature: signature error: one or more signature errors in a RBS file:
main.rb:7:3: C: Rbs/MethodSignature: signature error, sig/main.rbs:1:0...1:3: Syntax error: cannot start a declaration, token=def (kDEF)
  def test_required_positionals(key1, key2); end
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  • Rbs/MethodSignature: missing signature: method signature not found in the RBS files:
main.rb:7:3: C: Rbs/MethodSignature: missing signature
  def test_required_positionals(key1, key2); end
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  • Rbs/MethodSignature: signature mismatch: method signature has different arguments from the one defined in the RBS files:
main.rb:7:3: C: Rbs/MethodSignature: signature mismatch, expected: (untyped, untyped, untyped) -> void
  def test_required_positionals(key1, key2); end
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Do you like it? Star it!

If you use this component just star it. A developer is more motivated to improve a project when there is some interest.

Or consider offering me a coffee, it's a small thing but it is greatly appreciated: about me.

Contributors

License

The gem is available as open source under the terms of the MIT License.