Skip to content

Duplicate project import as a warning only #10933

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

philderbeast
Copy link
Collaborator

Pretty much the same as #9933 but gives a warning instead of an error when duplicate imports that are not cyclical are detected. I did this work in Oct 2024 but didn't raise a pull request for it then.

@philderbeast philderbeast force-pushed the fix/y-fork-project-import-warning-only branch from 16a11bd to 95ec86a Compare April 21, 2025 15:41
Copy link
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

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

Thanks!

@philderbeast philderbeast force-pushed the fix/y-fork-project-import-warning-only branch 3 times, most recently from c230d20 to b61e031 Compare April 27, 2025 00:52
@sebright sebright added the re: project-file Concerning cabal.project files label May 8, 2025
@philderbeast philderbeast force-pushed the fix/y-fork-project-import-warning-only branch from a926d99 to ec9ea13 Compare July 6, 2025 19:58
@philderbeast philderbeast force-pushed the fix/y-fork-project-import-warning-only branch from ec9ea13 to 7ab2b20 Compare July 15, 2025 14:19
@philderbeast philderbeast force-pushed the fix/y-fork-project-import-warning-only branch 2 times, most recently from d5552f3 to 0c99ae5 Compare July 25, 2025 12:25
@philderbeast philderbeast force-pushed the fix/y-fork-project-import-warning-only branch 3 times, most recently from 7fe8c13 to 61d8a74 Compare August 11, 2025 15:10
@philderbeast philderbeast force-pushed the fix/y-fork-project-import-warning-only branch 2 times, most recently from fd40a31 to 814b84c Compare August 11, 2025 19:29
@philderbeast
Copy link
Collaborator Author

I've updated the tests and moved them to cabal-testsuite/PackageTests/ProjectImport/UniquePathDuplicates/cabal.test.hs, fixing them for Windows and for the changes in the project parser.

- Add Y-forking import test
- A test for detecting when the same config is imported via many different paths
- Error on duplicate imports
- Do the filtering in duplicateImportMsg
- Use duplicateImportMsg for cycles too
- Add haddocks to IORef parameter
- Add changelog entry
- Use ordNub instead of nub
- Use NubList
- Share implement of duplicate and cyclical messages
- Update expectation for non-cyclical duplicate import
- Only show a warning
- Add woops project with a time cost
- Use noticeDoc instead of warn
- Render duplicate imports
- Add Ord instance for Dupes, sort on dupesNormLocPath
- Fixups after rebase
- Satisfy hlint
- Remove -XMultiWayIf
- Remove mention of yops from the changelog
- Satisfy fix-whitespace
- Test with a time cost of duplicate imports
- Fewer imports from PrettyPrint qualified as Disp
- Add data ProjectImport replacing tuples
- Combine fields as ProjectImport
- Rename field to dupesImports
- Add haddocks to Dupes fields
- Mark test as flaky
- Any test accessing stackage seems susceptible
- Move unique duplicates to own test
- Use legacy parser for path duplicates test
- Add foo.cabal package so that packages exist
- Satisfy fix-whitespace
- Use local version of lts-21.25
- Remove repo
- Use </> for expected paths
- Note that this change gives a warning.
@philderbeast
Copy link
Collaborator Author

This pull request is complete for the --project-file-parser=legacy. I'd prefer to add this feature to the parsec parser on a separate pull request.

@mpickering
Copy link
Collaborator

Is there an issue which describe the problem or feature this PR is adding?

@mpickering
Copy link
Collaborator

mpickering commented Aug 12, 2025

This pull request is complete for the --project-file-parser=legacy. I'd prefer to add this feature to the parsec parser on a separate pull request.

In the next + 1 release the legacy parser will be removed, so I would advise implementing the feature firstly for the parsec parser.

@philderbeast
Copy link
Collaborator Author

Is there an issue which describe the problem or feature this PR is adding?

From the description in this pull request:

Pretty much the same as #9933

From the description of #9933:

A follow on from #9578.

From the description of #9578:

Fixes #9562.

Before I started working on this stuff, there were some tests for cyclical imports but none for duplicates without cycles. This pull request adds these tests and reporting those duplicates as a warning when we'd punted on including this reporting as an error in an earlier pull request in the chain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: project-file Concerning cabal.project files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants