-
Notifications
You must be signed in to change notification settings - Fork 846
Don't repeat suggestion when no project config #6602
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
Don't repeat suggestion when no project config #6602
Conversation
@@ -516,6 +516,10 @@ pprintExceptions exceptions stackYaml stackRoot isImplicitGlobal parentMap wante | |||
<> blankLine | |||
<> indent 2 (spacedBulletedList recommendations) | |||
where | |||
prettyUserConfig = pretty (defaultUserConfigPath stackRoot) | |||
prettyStackYaml = pretty stackYaml | |||
isScript = show prettyUserConfig == show prettyStackYaml |
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.
@mpilgrem I don't know under what circumstances this might be true when not a script.
@philderbeast, I've worked out that your error message can be generated with Haskell script: {- stack script
--snapshot nightly-2024-06-07
--package dhall
-}
main = pure () and I agree that Stack should not:
I am puzzled why, currently, Stack thinks a global configuration file is a project-level configuration file. I am going to try to understand that first, before looking at your pull request. |
The answer to my puzzle is found in (project', stackYaml) <- case config.project of
...
PCNoProject extraDeps -> do
p <- ...
pure (p, config.userConfigPath) -- <<<< refering to the global configuration file! Q: Does that make any sense? How is the |
I am thinking that rather than: data BuildConfig = BuildConfig
{ ...
, stackYaml :: !(Path Abs File)
-- ^ Location of the stack.yaml file.
--
-- Note: if the STACK_YAML environment variable is used, this may be
-- different from projectRootL </> "stack.yaml" if a different file
-- name is used.
...
} this should be: data BuildConfig = BuildConfig
{ ...
, yamlFile :: !Either (Path Abs File) (Path Abs File)
-- ^ Either (Left) the location of the global configuration file or,
-- in most cases, (Right) the location of the project-level
-- configuration file.
--
-- Note: if the STACK_YAML environment variable is used, this may be
-- different from projectRootL </> "stack.yaml" if a different file
-- name is used.
...
} |
@philderbeast, in the end, I decided to address what you had identified at its 'origin' (the type of the field of the |
Closing, because #6607 has been merged. |
Follow up on #6601, improving the error message for #6600. In the case of a script when there is no project-level config, don't make suggestions to change the project-level config.
Here's a concrete example of before and after: