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

Feature request: setting to only lint files changed in the PR #35

Closed
fearphage opened this issue Jun 10, 2021 · 5 comments
Closed

Feature request: setting to only lint files changed in the PR #35

fearphage opened this issue Jun 10, 2021 · 5 comments

Comments

@fearphage
Copy link

Would be nice to limit linting to the current set of changed files.

@TrueBrain
Copy link
Owner

Can you explain to me a bit what your use-case is for such feature?

What I have seen from other GitHub Actions, these kind of features are not simple (as it depends a bit where you put the action in your workflow, and what type of workflow you are using). So, I rather not add such complexity to this action unless there is a good use-case for it :)

If you can help me out to better understand what problem you trying to solve, I might be able to help you out with a solution.

Tnx!

@fearphage
Copy link
Author

My use case is based on work. When I open a PR, I care about the files I'm changing. I'm not going to fix N other unrelated files because there are errors even though the build/action will fail in this case.

This is mostly an issue for newly linted (dirty) repos. Once things are in a good state, theoretically this would not be an issue going forward.

@TrueBrain
Copy link
Owner

Tnx, I understand what you are up against :) Yeah, in those cases it can be useful to only check a subset of files.

I have looked around a bit what the options are, and basically, this action already supports enough to do this yourself (at least, I think so). That is to say, the path parameter is what is send to flake8, so we say path, but it can also be files.

Now there are actions like this: https://github.com/marketplace/actions/get-changed-files
From my understanding, it fetches the changed files of a Pull Request. It returns that in an output. You can use that output as path parameter of this action, creating the behaviour you are looking for.

I think it is much better to do it like that, as that means this action doesn't need to complexity of figuring out what files changed; and it also doesn't make this action a jack-of-all-trades :D

I haven't tested this as such, but I don't see why it shouldn't work. If you need further help building this, I can make a PoC for you if you like. And if you figure out how to do this in a workflow, I would love to see the result, so anyone else looking for it can use it. I might even mention it in the README (or you can make a Pull Request to add it as example in the README :D).

Tnx, and let me know!

@TrueBrain
Copy link
Owner

hi @fearphage ,

Did you figure out how to do this? If there is anything I can help with, just let me know. Going to close this issue for now, as I think my suggestion will work very well, and is a lot cleaner. But if you get stuck or don't get it to work, just let me know, and I will see what I can do for you!

Cheers!

@fearphage
Copy link
Author

Did you figure out how to do this?

Your proposed solution should work. I haven't had a chance to try it. Thank you!

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

2 participants