Skip to content
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

--ignore-glob not working ? #1278

Closed
simonmichael opened this issue Aug 12, 2021 · 3 comments
Closed

--ignore-glob not working ? #1278

simonmichael opened this issue Aug 12, 2021 · 3 comments

Comments

@simonmichael
Copy link

I tried to use --ignore-glob, added in #117, but couldn't get it to work with current hlint. Am I doing it wrong ?

$ hlint --version
HLint v3.3.1, (C) Neil Mitchell 2006-2021
$ mkdir -p a/b
$ echo 'main = print (1)' > a/b/f.hs
$ hlint a | grep Warning
a/b/f.hs:1:14-16: Warning: Redundant bracket
$ hlint --ignore-glob=a a | grep Warning
a/b/f.hs:1:14-16: Warning: Redundant bracket
$ hlint --ignore-glob=a/b a | grep Warning
a/b/f.hs:1:14-16: Warning: Redundant bracket
$ hlint --ignore-glob=b a | grep Warning
a/b/f.hs:1:14-16: Warning: Redundant bracket
$ hlint --ignore-glob=f.hs a | grep Warning
a/b/f.hs:1:14-16: Warning: Redundant bracket
@tstenvold
Copy link

tstenvold commented Aug 17, 2021

It does indeed seem to not be working as shown. Maybe I don't understand its usage either. I've taken a look at it and found a simple fix for it to work as I think it's intended, but since I'm new to the project, I'm not keen on wildly submitting a PR.

I've two questions:
1. Should --ignore-glob only ignore directories? or both files and directories?
It appears that this should only handle directories, as files should have a declaration stating they should be ignored
2. Should --ignore-glob accept multiple items or just a single item?

@ndmitchell
Copy link
Owner

You have to pass patterns that match files, so if you want to ignore everything under a/b you have to pass a/b/**/*.hs. As an example, running on the HLint repo with --show to enable all ignored hints:

$ hlint src --show
10 hints
$ hlint src --show --ignore-glob "src/Test/*.hs"
9 hints

However, I can see why it's confusing that what you want isn't working, so I've just modified it so:

$ hlint src --show --ignore-glob "src/Test"
9 hints

That should answer the initial question. As to whether ignore-glob should accept multiple entries, you can stack them with hlint src --ignore-glob=src --ignore-glob=test etc. Code pushed, and I'll make a release later today.

@asheshambasta
Copy link

asheshambasta commented Mar 16, 2023

I'm not sure where else to report this, but --ignore-glob doesn't seem to work with me.

In my case, I have a dist-newstyle filter in ~/cosmos/core-data/core-data which I'd like to ignore.

The command in use is:

>>>>>  Full: 'nix-shell /home/ashesh/code/centralapp/cosmos/shell.nix --argstr capkgs core-data --run ghcid --lint="hlint --ignore-glob "/home/ashesh/code/centralapp/cosmos/**/dist-newstyle/**/*.hs""'

And I see the following in the output:



/home/ashesh/code/centralapp/cosmos/core-data/core-data/dist-newstyle/build/x86_64-linux/ghc-8.6.5/core-data-0.2.0.0/build/autogen/Paths_core_data.hs:50:11-28: Warning: Use <>
Found:
  dir ++ "/" ++ name
Perhaps:
  dir <> ("/" ++ name)

/home/ashesh/code/centralapp/cosmos/core-data/core-data/dist-newstyle/build/x86_64-linux/ghc-8.6.5/core-data-0.2.0.0/build/autogen/Paths_core_data.hs:50:18-28: Warning: Use <>
Found:
  "/" ++ name
Perhaps:
  ("/" <> name)

I've also tried various other alternatives to the pattern in ignore-glob, all to no avail.

I do have Paths_core_data module in other-modules of my cabal file, however. I'm not sure if that is the reason.

Versions:

-> % hlint --version
HLint v3.4.1, (C) Neil Mitchell 2006-2022
-> % ghcid --version
Auto reloading GHCi daemon v0.8.7

With ghc-8.6.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants