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

autofix not working #10

Closed
bejaz-lc opened this issue Sep 21, 2023 · 7 comments
Closed

autofix not working #10

bejaz-lc opened this issue Sep 21, 2023 · 7 comments

Comments

@bejaz-lc
Copy link

I'm using this action in my GitHub actions and autofix is true in .linelint.yml but this only report issues but doesn't auto fix them. I have also granted write permissions to the job in github action using permissions: contents: write.

I'm attaching Screen Shot of the configuration below
image

@fernandrone
Copy link
Owner

Hey @bejaz-lc . First of all, sorry for not responding. I had not been actively maintaining this repository this past year and ended up missing the notification.

Not sure if my answer is useful anymore but in any case I tried to reproduce your issue but wasn't able to. I've opened a test pull request adding several empty newlines to the README file of this repository (#15) and here's the result https://github.com/fernandrone/linelint/actions/runs/10048996615/job/27774177785?pr=15

As can be seen from the logs, the linelinter does fix the file...

[EOF Rule] File "README.md" has lint errors
[EOF Rule] File "README.md" lint errors fixed

However, it does so within the GitHub Action environment. If you want to apply these changes you'd have to run to add a new step that performs a "git push", or maybe opens a pull request from there. Not sure that's something I'd recommend.

Here's the .linelint.yml configuration file used, it's pretty much like yours https://github.com/fernandrone/linelint/blob/test-action/.linelint.yml

Let me know if that's been helpful 👍🏻

@arujjval
Copy link

@fernandrone thanks for responding.

I have tried this and still, the auto fix is not working. Maybe it's because there are many files in my repo which has this error. Does this have any issue with fixing errors when there are a lot of files?

Screenshot from 2024-07-24 11-34-38

@fernandrone
Copy link
Owner

fernandrone commented Jul 26, 2024

Hi @arujjval

The number of files should not be an issue.

Could I see your .linelint.yml file? The github action will take its configuration from there. My best guess is that there's a misconfiguration in the .linelint.yml or something else is preventing the linelint binary from interpreting it.

Also if you could share a link to the repository (if it's open source) or reproduce it in an open-source repository it'll be easier for me to help you.

Edit: also, here's the code for reading the config file (https://github.com/fernandrone/linelint/blob/test-action/linter/config.go#L42C6-L42C23). If a config file can't be found or there's an error reading it you should see a message like "No configuration file found" and the default config (no autofix) will be used.

@arujjval
Copy link

arujjval commented Jul 27, 2024

@fernandrone It worked when I put linelint@master instead of linelint@0.0.4.

Also, does it support the filtering of files? I mean, I only want to run the check on changed files, not on the whole repo.

@fernandrone
Copy link
Owner

Sorry, I see the issue now. The latest release is actually linelint@0.0.6, which includes a fix to the autofix property. Unfortunately since it was marked as a "pre-release" it would not show up as a GitHub Action (but linelint@master would would work fine as you find out).

I've updated release 0.0.6 to be a proper release and it's now showing up in the actions marketplace as intended:

image

@arujjval
Copy link

arujjval commented Aug 5, 2024

@fernandrone Thanks!

@fernandrone
Copy link
Owner

Closing this as it's solved.

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

3 participants