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

Add check for upper bound on any dependency in cabal check #8339

Closed

Conversation

jappeace
Copy link
Collaborator

@jappeace jappeace commented Aug 3, 2022

fixes #8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

I tested this by running cabal check on yesod-auth-simple (which has no upper bounds)
then added said upper bounds with cabal gen-bounds, and now it works.
I'd love to add a small minimal test suite if someone explains how to do it 😅


Please include the following checklist in your PR:

Please also shortly describe how you tested your change. Bonus points for added tests!

@jappeace jappeace changed the title Add check for upper bound on any package Add check for upper bound on any dependency in cabal check Aug 3, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)
@jappeace jappeace force-pushed the add-upper-bound-check-to-all branch from 84d54a0 to fb30717 Compare August 3, 2022 19:39
@@ -669,6 +670,9 @@ ppExplanation (UnknownArch unknownArches) =
"Unknown architecture name " ++ commaSep (map quote unknownArches)
ppExplanation (UnknownCompiler unknownImpls) =
"Unknown compiler name " ++ commaSep (map quote unknownImpls)
ppExplanation (MissingUpperBounds pname) =
"'" ++ unPackageName pname ++ "' misses upper bounds, add them"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can probably the convenience quote instead of "'" ++ xyz "'"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also why not indenting four spaces, since that is what is been used in ppExplanation.

@Mikolaj
Copy link
Member

Mikolaj commented Aug 3, 2022

@jappeace: you are lucky and your patch tripped an existing test. Perhaps just fix the test and so cover negative side of the testing story and then copy-paste, add the upper bound, simplify and the positive side (no warning) is covered as well.

Thank you for the tiny changelog file. That's very helpful for the poor chap making releases.

@@ -669,6 +670,9 @@ ppExplanation (UnknownArch unknownArches) =
"Unknown architecture name " ++ commaSep (map quote unknownArches)
ppExplanation (UnknownCompiler unknownImpls) =
"Unknown compiler name " ++ commaSep (map quote unknownImpls)
ppExplanation (MissingUpperBounds pname) =
"'" ++ unPackageName pname ++ "' misses upper bounds, add them"
Copy link
Collaborator

Choose a reason for hiding this comment

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

A list of dependencies missing upper bounds would e great (plus, the specific target).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

what's a target?

@@ -2398,6 +2391,18 @@ checkGlobFiles verbosity pkg root =
getWarning field glob (GlobMissingDirectory dir) =
[ PackageDistSuspiciousWarn (GlobNoDir field glob dir) ]

toDependencyVersionsMap :: (PackageDescription -> [Dependency]) -> GenericPackageDescription -> Map PackageName VersionRange
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this function at this line (i.e.: far away from where it is used, not in the utils part of the file)?

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 moved this to the utils section

@ffaf1
Copy link
Collaborator

ffaf1 commented Aug 3, 2022

Good stab @jappeace. I have added some comments, hopefully you don't mind.
I can help with testing/formatting if necessary; happy hacking!

@@ -7,7 +7,7 @@ license: MIT

library
default-language: Haskell2010
build-depends: base ^>=4.14, internal
build-depends: base ^>=4.14, internal ^=0
Copy link
Member

Choose a reason for hiding this comment

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

I think the requirement should be lifted for libraries belonging to the same package

@@ -669,6 +670,9 @@ ppExplanation (UnknownArch unknownArches) =
"Unknown architecture name " ++ commaSep (map quote unknownArches)
ppExplanation (UnknownCompiler unknownImpls) =
"Unknown compiler name " ++ commaSep (map quote unknownImpls)
ppExplanation (MissingUpperBounds pname) =
"'" ++ unPackageName pname ++ "' misses upper bounds, add them"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a gentler "consider adding them with...", since for now it's just a PackageDistSuspiciousWarn. Also I wonder if we should add (a link to) a longer explanation of the problem

@ulysses4ever
Copy link
Collaborator

@jappeace just FYI: you're double-lucky now, as it's the second time you got into borked CI situation (tracked as #8356).

@@ -9,6 +9,6 @@ library
default-language: Haskell2010
build-depends:
, base ^>=4.14
, somelib:internal
, somelib:internal ^>=1.0
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'm uncertain what this syntax somelib:internal means, I assumed somelib is a dependency.
There appears no docs on this syntax (note that this is the other multilib failing now, not mulitlib 1, which I fixed).

Copy link
Member

Choose a reason for hiding this comment

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

I think somelib is a dep, internal is its component.

... probably not the best approach
@jappeace
Copy link
Collaborator Author

@ulysses4ever hitting it now, I guess this technically passes, thanks for letting me know.

@Mikolaj
Copy link
Member

Mikolaj commented Aug 11, 2022

Let me rebase to see if the recent CI workaround unblocks your testing.

@Mikolaj
Copy link
Member

Mikolaj commented Aug 11, 2022

@mergify rebase

@mergify
Copy link
Contributor

mergify bot commented Aug 11, 2022

rebase

❌ Pull request can't be updated with latest base branch changes

Mergify needs the author permission to update the base branch of the pull request.
@SupercedeTech needs to authorize modification on its head branch.
err-code: D81BA

@Mikolaj
Copy link
Member

Mikolaj commented Aug 11, 2022

Uhoh, @jappeace, it seems your branch is protected from meddling by the sketchy cabal admins, which is understandable, but also implies that Mergify won't be able to merge your PR. Would it be possible to unlock the branch?

@jappeace
Copy link
Collaborator Author

I've done nothing but the defaults 😅
How does one unlock branches?

@Mikolaj
Copy link
Member

Mikolaj commented Aug 11, 2022

"Allow edits and access to secrets by maintainers" at the bottom right, if it exists? Probably your or your org's (SupercedeTech?) defaults are more strict than normally.

@jappeace
Copy link
Collaborator Author

jappeace commented Aug 11, 2022

I pressed a big "update" button, probably wrong. I'll just re-open this from my personal account, that should make it work

@Mikolaj
Copy link
Member

Mikolaj commented Aug 11, 2022

Sorry for the inconvenience. If that's too much trouble, we can work around, abusing our review process.

@jappeace jappeace mentioned this pull request Aug 11, 2022
3 tasks
@jappeace
Copy link
Collaborator Author

recreated in #8361

@jappeace jappeace closed this Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cabal check should warn about missing upper bounds
5 participants