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

Recognise hpack projects in addition to cabal ones #1435

Merged
merged 3 commits into from Mar 17, 2018

Conversation

Projects
None yet
2 participants
@sergv
Contributor

sergv commented Mar 17, 2018

The flycheck-haskell project is about to add support for hpack-basked Haskell projects. The difference from standard Haskell projects here is that instead of .cabal file a project has package.yaml file. Note that while .cabal file has different names for different packages, hpack's project file is always named package.yaml. Even though .cabal and package.yaml are frequently both present, in theory users can have only package.yaml present. So the proposed change is to recognized package.yaml as possible Haskell project file, just as we currently do for .cabal files.

The flycheck-haskel subproject is about to add similar support (flycheck/flycheck-haskell#85), thus I thought it's a good time to add it to flycheck as well.

@cpitclaudel

Thanks a lot. Looks great.
I've suggested one simplification and pointed out a typo.

flycheck.el Outdated
@@ -7979,7 +7979,7 @@ contains a cabal file."
(when (buffer-file-name)
(flycheck--locate-dominating-file-matching
(file-name-directory (buffer-file-name))
".+\\.cabal\\'")))))
"\\`\\(?:.+\\.cabal\\|package\\.yaml\\)\\'")))))

This comment has been minimized.

@cpitclaudel

cpitclaudel Mar 17, 2018

Member

I think you can strip the \\`\\(?:.+ part of this regexp

@@ -7951,7 +7951,7 @@ containing a file that matches REGEXP."
(locate-dominating-file
directory
(lambda (dir)
(directory-files dir t regexp t))))
(directory-files dir nil regexp t))))

This comment has been minimized.

@cpitclaudel

cpitclaudel Mar 17, 2018

Member

Typo (themlesves) in the commit message.

@@ -7979,7 +7979,7 @@ contains a cabal file."
(when (buffer-file-name)

This comment has been minimized.

@cpitclaudel

cpitclaudel Mar 17, 2018

Member

Can we shorten the commit header to fit in 72 characters?

@@ -9,6 +9,8 @@
[GH-1289]
- ``rust-cargo`` does not use the variable ``flycheck-rust-args`` anymore
[GH-1289]
- Improve detection of default directory for ``haskell-ghc`` to consider
``hpack`` project files [GH-1435]

This comment has been minimized.

@cpitclaudel

cpitclaudel Mar 17, 2018

Member

I'd possibly phrase this as "Consider hpack project files when selecting the directory to run haskell-ghc from. But I like your phrasing too.

sergv added some commits Mar 16, 2018

Don't ask for full paths when running `locate-dominating-file'
It doesn't change the behaviour because `locate-dominating-file' wants
to know whether there are any files matching a regexp, but it's not
interested in the paths themselves.

@sergv sergv force-pushed the sergv:recognise-hpack-projects-in-addition-to-cabal-ones branch from 29ec627 to 2a5cc6d Mar 17, 2018

@sergv

This comment has been minimized.

Contributor

sergv commented Mar 17, 2018

Thanks for your suggestions and prompt response! I've fixed all items, however I remain a bit uneasy about new regexp because it needs to match either file ending in .cabal or a literal package.yaml string, for which I had to duplicate the \\' bit.

@cpitclaudel

This comment has been minimized.

Member

cpitclaudel commented Mar 17, 2018

Looks good, thanks. The new regexp is good (you could also have parenthesized around the \\| and had a single \\', but I don't think it matters.

@cpitclaudel cpitclaudel merged commit 73b27c0 into flycheck:master Mar 17, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment