-
Notifications
You must be signed in to change notification settings - Fork 371
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
lint: add W74 to detect 'pin-depends' packages that are not present in 'depends' nor in 'depopts' #6317
base: master
Are you sure you want to change the base?
Conversation
20cbb73
to
186ab9a
Compare
…n 'depends' nor in 'depopts'
186ab9a
to
aed41b2
Compare
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.
The code can be improved by eliminating 3 out of the 6 datatypes traverses.
The gain is small in this particular case but out of principle it feels weird to not do better if the code is as short and maybe even more understandable
List.map fst t.pin_depends | ||
|> OpamPackage.Set.of_list | ||
|> OpamPackage.names_of_packages |
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.
List.map fst t.pin_depends | |
|> OpamPackage.Set.of_list | |
|> OpamPackage.names_of_packages | |
List.fold_left | |
(fun (pkg, _) set -> OpamPackage.Name.Set.add (OpamPackage.name pkg) set) | |
t.pin_depends OpamPackage.Name.Set.empty |
OpamPackage.Name.Set.diff pkgs all_depends | ||
|> OpamPackage.Name.Set.elements | ||
|> List.map OpamPackage.Name.to_string |
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.
OpamPackage.Name.Set.diff pkgs all_depends | |
|> OpamPackage.Name.Set.elements | |
|> List.map OpamPackage.Name.to_string | |
OpamPackage.Name.Set.fold | |
(fun pkgname acc -> OpamPackage.Name.to_string pkgname :: acc) | |
(OpamPackage.Name.Set.diff pkgs all_depends) [] |
I find the set transformation by pipe more human understandable (you just follow the function name, not read the code of the function given to fold). But agree on the optim part. |
fix #5795
This lint doesn't detect when the versions mismatch.