-
Notifications
You must be signed in to change notification settings - Fork 222
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
Fix #1521 lib/Rex/CLI.pm: Use $SIG{__WARN__} when loading Rexfile instead of stderr redirection #1522
Conversation
f40a0fc
to
02d13ad
Compare
It seems brutal Perl::Critic warnings must be approved too :)
|
2f632ad
to
c6e9b3f
Compare
eebb15c
to
59d1856
Compare
d350510
to
5b80cc5
Compare
Thanks, @uralm1, for the pull request, updating it, and for your patience. I see it now passes all the tests, so I can safely start reviewing it to understand the proposed changes. I am particularly excited about the Rexfile loading tests 👍 That idea came up recently related to other topics as well.
Well, usually not "approved", but fixed properly or cleaned up ;) Either by fixing the violation itself (preferred), configuring the rule (also good), or deciding that a specific rule is not important at all for the codebase as a whole, and then ignore it (sometimes it's the right thing to do). Rex codebase is a result of 100+ contributors over more than a decade, so the code quality is a big mix of everyone's preferences at the time they contributed. Therefore Test::Perl::Critic::Progressive is being used in the test suite to at least stop introducing further Perl::Critic violations. In other words, the list of violations should get shorter with each pull request, or at least should stay the same. There are also a few words about this in the Contributing guide under Code quality. |
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.
Thanks for the patience about this PR!
I have to admit I had a hard time to wrap my head around all the details and implications. Last night I spent another few hours on it, and I could finally have some enlightenment about what's going on and how to go forward.
All in all, I like the new approach, and especially the new tests. Most comments are about:
- rounding up the story by checking related project history
- cleaning up perlcritic violations instead of disabling them
- simplifying the test approach
I believe most of the remaining actions here are more tedious than complex, and it might work well to even do it together.
I would suggest coordinating work some time via Matrix/IRC, or even pairing up under the umbrella of my open source office hours offering.
Ok, @ferki, thank you for participation! I'll reorganize PR as suggested when I get free time (open source office hours - what a brilliant idea :) I sadly have to state that currently switched to ansible for new tasks due it windows support. I like perl and Rex approach (contrary to jinja and yaml programming), so I'm going to keep an eye on it. |
Thanks! If you don't mind working in a shared branch, I might be able to push most of the proposed changes here as well to keep it in a single place. I might also do a rebase instead of merging back the current default branch here to keep the history cleaner.
It might be rare in the general open source development world (mostly isolated individuals working async), but I find it's often best to collaborate in pairs or groups – so I offer the possibility to do so :) I'm glad you like the idea!
As long as it's the one that helps you most to get your stuff done, that's fine! 👍 Rex can run on Windows, have limited capability to manage it locally, and there's some proof of concept code to remotely manage it too. I'm not aware of anyone having proprietary solutions built in-house for full Windows support, though. It also seems nobody stepped up yet to develop, maintain, or sponsor the same as an open solution. If you are interested, let's chat!
Right, the approach to coding is a major difference. While I love the freedom granted by a mature and proper programming language, I also like the diversity of projects so everyone may find the one that fits their use case the most. |
FYI, I hacked on this for a while, and by tidying up the split out sample Rexfiles, I managed to find a further bug: I decided to just add In any case, I started to push my related work into my personal fork under the same branch name. |
dfe68be
to
347e328
Compare
Oops, didn't mean to push here yet, so I restored this to the previous HEAD (347e328). I might push here when I'm ready, sorry for the noise. |
de1e5f2
to
1bea0ce
Compare
Thanks @uralm1 for the updates! Splitting those commits out are useful, and I'm going to update my fork's branch with them 👍 I think I figured out most of the remaining steps already in my local experiments, but I still need to split them into logical step-by-step commits, so I haven't pushed the full story yet. I just note this so we don't accidentally end up duplicating work. |
OK, so I pushed an updated version to my branch, so you can see the outline of changes I've already made. It's basically:
Since you cleaned up
|
Tested https://github.com/ferki/Rex/tree/load_rexfile_test_and_fix - all is good, but I have concerns about strict comparsion of logs. This can make test fragile... to perl version or (may be) windows build. |
This change ferki@03140ce hides? redirection warning.
Definitely this needs more hacking. |
No subroutine redefinition warnings on 5.36.0According to the Changes to Existing Diagnostics section of perldelta for perl-5.36.0:
My machines have 5.36.0, and GitHub Actions are using the This explains why I did not get any warnings when I removed Overriding subroutines in the test suiteThe above means we have a nice way of overriding subroutines without any perlcritic violations and without using external modules if we are running on 5.36.0 – but we do want to support older perl versions as well, so I took another look at the topic. My second attempt at using Sub::Override for the replacing subroutines in the tests has also been successful, so I've updated my fork's branch with that. That module would be useful in other tests as well (like Exit behaviorAt this point I would like to draw a line somewhere around near here to stop inflating this PR with more and more concerns. I agree it might be useful to look into the exit behavior at various points in Rex core. If that is desired, let's do that separately unless it blocks the progress we already made here. In my current understanding of the scope of this PR, overriding either So I would propose to go towards merging the progress we already achieved, and do subsequent changes in separate smaller chunks on their own if possible. |
Currently the minimum perl version needed by Rex is 5.10.1, but Since all the original regular expressions are gone due to the data-driven testing approach, I could also drop the two commits that were solving the I plan to split out at least one other commit from here, as the one tuning the I don't see any other obvious simplification opportunity, so I'll push my branch here after that to update the PR. |
This reverts the remaining parts of 4a1ae27.
1bea0ce
to
644cb6d
Compare
I've applied some new Let's see the test results first, but now I consider it close to be merged. |
Looks good for me, can be tested on huma... be merged. |
It is now merged 🎉 Thank you @uralm1 for your patience, and for your original work on both improving the test coverage and the general approach of Rexfile loading! ❤️ |
This PR is an attempt to fix #1521
Also test for load_rexfile() is added.