Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Make readProjectFromPaths use typed paths. #355

Merged
merged 7 commits into from
Oct 22, 2019

Conversation

patrickt
Copy link
Contributor

@patrickt patrickt commented Oct 21, 2019

This function has been a bête noire for some time; I’m glad to see it getting some type safety.

@patrickt patrickt requested a review from a team October 21, 2019 21:57
<*> argument str (metavar "DIR")
<*> optional (pathOption (long "root" <> help "Root directory of project. Optional, defaults to entry file/directory." <> metavar "DIR"))
<*> many (pathOption (long "exclude-dir" <> help "Exclude a directory (e.g. vendor)" <> metavar "DIR"))
<*> argument path (metavar "PATH")
Copy link
Contributor

Choose a reason for hiding this comment

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

It’s still expected to be a directory, right? The metavar should probably still indicate that.

Edit: I believe I was mistaken, so this is a good detail to have caught 👍 thank you!

readProjectFromPaths :: MonadIO m => Maybe FilePath -> FilePath -> Language -> [FilePath] -> m Project
readProjectFromPaths :: MonadIO m
=> Maybe Path.AbsRelDir -- ^ An optional root directory for the project
-> Path.AbsRelFileDir -- ^ A file or directory to parse. Passing a file path loads all files in that file's parent directory.
Copy link
Contributor

Choose a reason for hiding this comment

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

I gotta say, I’m not sold on this semantic, but it looks to me like you’re maintaining the current behaviour and not introducing this so let’s see about resolving it separately from this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it’s pretty shifty! Revealing weirdnesses like this is one of my favorite parts of adding pathtype everywhere: it lays bare the sins were committing and not even knowing it.

@patrickt patrickt changed the base branch from git-out to master October 22, 2019 16:26
@patrickt patrickt merged commit 7e46bc3 into master Oct 22, 2019
@patrickt patrickt deleted the pathtype-project-from-path branch October 22, 2019 18:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants