-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Add MPICH cop and test #6214
Add MPICH cop and test #6214
Conversation
Note: Edited Previous details about expected vs observed behaviorOutdated Contents
This is out of date because Markus showed me how to resolve my issueWhat I expect to happenCop passes the test which I wrote for it. I don't fully understand how the cop output relates to the expected spec output. Maybe I need to dig around in What actually happensI can run diff --git i/Formula/opencoarrays.rb w/Formula/opencoarrays.rb
index 6e32a36394..58afc7826c 100644
--- i/Formula/opencoarrays.rb
+++ w/Formula/opencoarrays.rb
@@ -14,7 +14,7 @@ class Opencoarrays < Formula
depends_on "cmake" => :build
depends_on "gcc"
- depends_on "open-mpi"
+ depends_on "mpich"
def install
mkdir "build" do $ brew audit --strict opencoarrays
opencoarrays:
* C: 17: col 3: Use 'depends_on "open-mpi"' instead of 'depends_on "mpich"'.
Error: 1 problem in 1 formula detected
$ brew audit --strict scalapack # un-modified, uses open-mpi
# returns 0, no output However, if I run
I get:
What I don't understandIs there an instance variable that needs to be set somewhere to pickup the offense source range that's not getting set? Am I not specify the test correctly? The test output outputs the dummy ruby formula source, but does not seem to underline it and print my error message from the cop. |
Same error on CI as when run locally
|
@@ -782,5 +782,16 @@ class Foo < Formula | |||
end | |||
RUBY | |||
end | |||
|
|||
it "reports an offense when using depends_on \"mpich\"" do | |||
expect_offense(<<~RUBY) |
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.
expect_offense(<<~RUBY) | |
expect_offense(<<~RUBY, "/homebrew-core/") |
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.
@reitermarkus you rock! Thanks, that fixed it!
Should I break this back out into its own class again if I want to provide auto-correct functionality? I can add a test for that too, it looks like, now that I understand how that works. I think if I leave it in the miscellaneous class, which currently has no auto-correct, the auto-correct won't be specific to just the MPI lib choice test, but to the entire class (maybe?).
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.
Yeah, I think a separate class for each auto-correctable cop is preferable.
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.
Can I keep it in lines.rb or should I make a new file/module?
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.
@reitermarkus why does your change resolve the problem?
I was looking for documentation on expect_offense()
and came up with https://www.rubydoc.info/gems/rubocop/RuboCop%2FRSpec%2FExpectOffense:expect_offense
The second argument, file
is not well documented there, IMO. Is that argument taken to be a hypothetical path to the source?
- Split off from PR Homebrew#6209 - Create stand alone class for cop w/ auto-correct
test failure
EDIT: further refactoring & testing ideasThere are a number of cops checking stuff about I was considering moving these to their own file, |
Makes sense! I'd suggest making it a separate/follow-up PR, though. |
Fixed up |
If I run Thanks for cleaning up after me! |
No. |
Well, that's where I went wrong I guess. Thanks again! |
Tests are passing locally now, one CI build failure seemed like a cloud/network issue
Split off from PR Update documentation to codify MPI and BLAS/LAPACK library choices & link rubydoc #6209
Have you followed the guidelines in our Contributing document?
Have you checked to ensure there aren't other open Pull Requests for the same change?
Have you added an explanation of what your changes do and why you'd like us to include them?
Have you written new tests for your changes? Here's an example.
Have you successfully run
brew style
with your changes locally?Have you successfully run
brew tests
with your changes locally?