-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the rubocop-rake
and rubocop-rspec
gems
#285
Conversation
The project dependencies now allow rack 3 to be installed. This backwards incompatible version extracted handlers in a new `rackup` gem. While we could indicate we prefer to use rack 2 which is still receiving update, it is more future-proof to update our code to be compatible with the latest version of the dependency. This is a development dependency only so will not affect users of the project.
Under normal operation, we have a single instance of the `Riemann::Tools::HttpCheck` class for the lifetime of the monitoring process. But when testing, we create a new instance for each test, each with its resolvers and worker thread pools. The test process will have more and more threads, until it eventually hit the OS limit of the maximum number of threads for a process and cause an exception: > ThreadError: can't create Thread: Resource temporarily unavailable Make sure that the threads are terminated at the end of each test to avoid running out of resources if they are limited.
The `rubocop-rake` and `rubocop-rspec` are listed as dependencies, but they where not enabled in rubocop configuration. Enable them, and disable a bunch of cops that are not relevant at this point.
These are generaly smells, but here it makes our life simple, so just ignore these cops in this situation.
RSpec/EmptyLineAfterExampleGroup: Add an empty line after context. RSpec/EmptyLineAfterSubject: Add an empty line after subject. RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let.
New cops are not enabled by default by rubocop because they can be disruptive. They are however relevant regarding the code quality, and because the activity on the project is rather low, enable them.
…e it is implied by default.
…arying precedence with parentheses to avoid ambiguity
{ state: 'warning' } | ||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a bug? In this case we should extract it to another PR with a bug
label so that it appears clearly in the changelog. Or maybe I miss something?
Gemspec/RequireMFA: | ||
Enabled: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to require the usage of MFA, but according to rubygems.org "(some) owners are not using multi-factor authentication (MFA)."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's @aphyr - when you get a chance, could you enable MFA on RubyGems if that works? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I opened #286 to address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from what I can see. I don't take issues with any of the cleanup.
Rubocop is not configured to detect and help fixing all issues it can spot. Enable this code to improve further the code of the gem.
Also include:
Riemann::Tools::HttpCheck
threads between tests #284