0.01
No release in over a year
...
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

rubocop-twirp

Gem codecov

Improve your Twirp code with RuboCop

Install

gem install rubocop-twirp

Add to your Gemfile

gem "rubocop-twirp", require: false

Add to .rubocop.yml

require: rubocop-twirp

Usage

Scan and fix issues

rubocop -r rubocop-twirp --only Twirp -A

Fix Twirp::ClientResp breaking change introduced in Twirp v1.10. (Cop disabled by default)

rubocop -r rubocop-twirp --only Twirp/DeprecatedArguments -A

Cops

Twirp/ClientResponse

Use webmock-twirp to stub Twirp client responses.

# bad
allow(MyTwirpClient).to receive(:my_rpc).and_return(Twirp::ClientResp.new(...))

# good
stub_twirp_request(MyTwirpClient, :my_rpc).to_return(...)

Twirp/DeprecatedArguments

Checks that Twirp::ClientResp uses keyword arguments instead of positional arguments. Needed for Twirp >= 1.10

# bad
Twirp::ClientResp.new(data, error)

# good
Twirp::ClientResp.new(data: data, error: error)

Twirp/RSpecBeA

Use rspec-twirp to simplify specs.

# bad
expect(...).to be_a(Twirp::ClientResp)
expect(...).to be_a(Twirp::Error)

# good
expect(...).to be_a_twirp_response
expect(...).to be_a_twirp_error

Contributing

Yes please :)

  1. Fork it
  2. Create your feature branch (git checkout -b my-feature)
  3. Ensure the tests pass (bundle exec rspec)
  4. Commit your changes (git commit -am 'awesome new feature')
  5. Push your branch (git push origin my-feature)
  6. Create a Pull Request

Resources