michaelherold / benchmark-memory

Memory profiling benchmark style, for Ruby 2.1+
MIT License
217 stars 6 forks source link

Refactored RSpec color configuration. #8

Closed bkuhlmann closed 5 years ago

bkuhlmann commented 5 years ago

Overview

Minor refactoring and cleanup for with local development.

Details

See commits for details.

Notes

Seeing the following Rubocop issues (discovered via my Git Hooks attempting to run Rubocop):

Warning: unrecognized cop Naming/UncommunicativeMethodParamName found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Performance/OpenStruct found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Style/IpAddresses found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Style/MultilineMethodSignature found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Naming/UncommunicativeMethodParamName found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Performance/OpenStruct found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Style/IpAddresses found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Style/MultilineMethodSignature found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Error: Unknown Ruby version 2.6 found in `.ruby-version`.
Supported versions: 2.1, 2.2, 2.3, 2.4, 2.5
error: failed to push some refs to 'git@github.com:bkuhlmann/benchmark-memory.git'

I think this is due to Rubocop getting confused with me using a development environment of Ruby 2.6.0. Anyway, might be another issue to tackle.

michaelherold commented 5 years ago

The Rubocop warnings look like you're using a different version of Rubocop than this project uses. They change the names and namespaces for their cops fairly regularly.

The Bundler requirement is intended to communicate that you're expected to use Bundler to install the development dependencies for the project. I prefer to keep those in a Gemfile rather than as development dependencies in the gem specification for tidiness.

What was the error that you were seeing when using Ruby 2.6? Perhaps we need only relax the requirement for Bundler so it can use Bundler 2, which is (I think) the version of Bundler that is bundled (hah) with Ruby 2.6.

bkuhlmann commented 5 years ago

The Bundler requirement is intended to communicate that you're expected to use Bundler

Yeah, I see your point. With Ruby 2.6.0, though, I'm not sure if Bundler needs to be imposed (plus a version of Bundler is captured in the Gemfile.lock now so you'd have everything you need, automatically, to communicate to developers of this project).

Regarding Rubocop...it's got some interesting behavior. For example, here's some further info.

Current Version:

bundle exec rubocop -v # => 0.52.1

Running Rubocop without a config fails:

bundle exec rubocop 

# Output:
Warning: unrecognized cop Naming/UncommunicativeMethodParamName found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Performance/OpenStruct found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Style/IpAddresses found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Warning: unrecognized cop Style/MultilineMethodSignature found in /Users/bkuhlmann/.rubocop-https---raw-githubusercontent-com-bkuhlmann-code-quality-3-0-0-configurations-rubocop-ruby-yml
Error: Unknown Ruby version 2.6 found in `.ruby-version`.
Supported versions: 2.1, 2.2, 2.3, 2.4, 2.5

Running Rubocop with an explicit configuration works!

bundle exec rubocop -c .rubocop.yml

# Output:
Inspecting 40 files
........................................

40 files inspected, no offenses detected

For some reason Rubocop is attempting to pick up/inherit my global configuration as provided by my Dotfiles (i.e. $HOME/.rubocop.yml). That's new to me as I've not experienced that before. I have a workaround at least.