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

Fixes #36337 - Update rake and clamp deps #367

Merged
merged 3 commits into from May 4, 2023

Conversation

ofedoren
Copy link
Member

This PR updates rake to any latest available and updates clamp to be any version, but 2.0.0 (currently, the latest is 1.3.2).

There is also some refactoring due to clamp changes and some refactoring due to rake spamming a lot of Ruby warnings. I fixed majority of them (mostly it was uninitialized variable warning, although I'm not sure that's a good idea: https://bugs.ruby-lang.org/issues/17055#note-6)

Anyway, there is a new warning flag for rake's TestTask, which suppresses all Ruby warnings. Without this flag quite a lot of our tests will fail since they depend on strict output. I left RUBY_WARNINGS env variable to be set to run the tests with Ruby warnings.

@ofedoren
Copy link
Member Author

[test hammer]

lib/hammer_cli/logger.rb Outdated Show resolved Hide resolved
@ofedoren ofedoren force-pushed the ref-36337-update-rake-clamp branch from ecead38 to 671f1dc Compare May 2, 2023 09:30
@ofedoren
Copy link
Member Author

ofedoren commented May 2, 2023

Thanks, @ekohl, updated.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I think the undefined variables changes make the code harder to understand. It'd be good to separate those out and review them separately.

lib/hammer_cli/abstract.rb Outdated Show resolved Hide resolved
@ofedoren
Copy link
Member Author

ofedoren commented May 2, 2023

Thanks, @ekohl, I've splitted all the changes here to separate commits. I hope this will make review easier.

Also, since theforeman/hammer-cli-foreman#613 contains quite similar changes, I'll update that one after this PR gets resolved/approved.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

https://stackoverflow.com/questions/2098742/ruby-instance-variable-not-initialized-warning/2098835#2098835 suggests the undefined warning goes away with Ruby 3.0. Since you disable warnings anyway, perhaps the last commit should be trimmed down or even skipped.

hammer_cli.gemspec Outdated Show resolved Hide resolved
Rakefile Outdated Show resolved Hide resolved
lib/hammer_cli/utils.rb Show resolved Hide resolved
lib/hammer_cli/abstract.rb Outdated Show resolved Hide resolved
lib/hammer_cli/abstract.rb Outdated Show resolved Hide resolved
lib/hammer_cli/apipie/resource.rb Outdated Show resolved Hide resolved
@ofedoren ofedoren force-pushed the ref-36337-update-rake-clamp branch from 6da6bd2 to 3e93338 Compare May 3, 2023 14:35
@ofedoren
Copy link
Member Author

ofedoren commented May 3, 2023

suggests the undefined warning goes away with Ruby 3.0

And I found the commit with that :) ruby/ruby@01b7d5a

So, I've decided to drop the last commit. Hammer is already slow, it's not worth to slow it more.

Updated, but without new changes related to uninitialized variables.

@ofedoren ofedoren force-pushed the ref-36337-update-rake-clamp branch from 3e93338 to 8bcd3d4 Compare May 3, 2023 14:40
@@ -11,6 +11,7 @@ def initialize(names, description, subcommand_class, options = {})
@subcommand_class = subcommand_class
@hidden = options[:hidden]
@warning = options[:warning]
super(@names, @description, @subcommand_class)
Copy link
Member

Choose a reason for hiding this comment

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

If you call this, I wonder if names, description and subclass_command aren't already stored. I think you can drop @names = etc.

Copy link
Member Author

@ofedoren ofedoren May 4, 2023

Choose a reason for hiding this comment

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

Not really, AFAIR I've added this line because something wasn't initialized in clamp itself, crashing the commands.

Also, I rather call super with explicit arguments because implicitly it would send params as well, which is not supported by clamp.

UPD: Right, I thought you meant a different thing, my bad.

UPD2: Actually, it seems we still need explicit assignments for these instance variables.

@ekohl ekohl merged commit af674ad into theforeman:master May 4, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants