Skip to content
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

Merged
merged 20 commits into from
Jan 22, 2024
Merged

Enable the rubocop-rake and rubocop-rspec gems #285

merged 20 commits into from
Jan 22, 2024

Conversation

smortex
Copy link
Collaborator

@smortex smortex commented Jan 21, 2024

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:

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.
{ state: 'warning' }
{}
Copy link
Collaborator Author

@smortex smortex Jan 21, 2024

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?

@smortex smortex added the skip-changelog Excluded from CHANGELOG label Jan 21, 2024
Comment on lines +10 to +11
Gemspec/RequireMFA:
Enabled: false
Copy link
Collaborator Author

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)."

Copy link
Member

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!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Collaborator Author

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.

@smortex smortex marked this pull request as ready for review January 21, 2024 19:32
@smortex
Copy link
Collaborator Author

smortex commented Jan 21, 2024

This PR (and #283, #284 included in this PR) are a lot of small changes. In order to make reviewing WIP work more easily (e.g. #282 where I hit these issues), I would like this PR to be reviewed and merged. Thanks!

Copy link
Member

@jamtur01 jamtur01 left a 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.

@jamtur01 jamtur01 merged commit 2439597 into main Jan 22, 2024
8 checks passed
@jamtur01 jamtur01 deleted the rubocop branch January 22, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Excluded from CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants