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

Allow relative paths #54

Open
howardjohn opened this issue Jun 6, 2023 · 2 comments
Open

Allow relative paths #54

howardjohn opened this issue Jun 6, 2023 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@howardjohn
Copy link

Currently, we have a bunch of rules like

        files:
          - "!**/pkg/a/**"
          - "!**/pkg/b/**"

Ideally we could write something like

        files:
          - "!./pkg/a/**"
          - "!./pkg/b/**"

Or

        files:
          - "!$root/pkg/a/**"
          - "!$root/pkg/b/**"

Where this is relative to is up to debate, but probably the module root makes the most sense?

ps: thanks for the great linter!

@dixonwille dixonwille added the enhancement New feature or request label Jun 6, 2023
@dixonwille
Copy link
Member

I'll see if it is possilbe... I have to turn everything into an absolute path as that is what I am given from golang's tools. A hack would be to expand either . or $root with ** but then I feel like it is lying.

I do like the variable approach though! Wonder if $git could be the root of the git repository and $mod could be the go module (would need to play around with a mono repo with multiple mod files).

@dixonwille dixonwille added this to the v2.2.0 milestone Oct 31, 2023
@dixonwille dixonwille modified the milestones: v2.2.0, v2.3.0 Nov 17, 2023
@qwerty287
Copy link

qwerty287 commented Dec 28, 2023

Hi,

it seems that this is necessary for us to be able to use it because we have various directories both in top-level but also in subdirectories.

Example tree:

├── somedir
│   └── some_file.go
└── anotherdir
    └── somedir
        └── another_file.go

I'd like to only scan somedir/*.go, but I can't - because I have to specify **/somedir/*.go and this also matches anotherdir/somedir/*.go.

Of course, I can add a lot of ! statements to ignore them, but I don't think this is a good way to go.

A hack would be to expand either . or $root with ** but then I feel like it is lying.

Indeed, that would be useless. Wouldn't it be possible to expand ./$root (I don't care which one you choose) to the current working directory/root path of the project?

Thanks!

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

No branches or pull requests

3 participants