-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add formatting feature #25
Conversation
This commit adds one big feature and several small fixes. Features: - Adds formatting support Small changes: - Shell was changed from dash to bash - The remark_flags argument was replaced with the often used args argument.
README.md
Outdated
```yaml | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not available for this action users, but just for the developer of this action.
Can you remove it or do you think it's useful for users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haya14busa Thanks a lot for pointing this out I will try to create another way for users to add additional flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haya14busa I removed this option from the readme. The user now can supply additional arguments using the remarks_flags
argument.
|
||
Supported linters: | ||
This action can be combined with [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) or [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) to also apply the annotated changes to the repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this feature or use reviewdog -f=diff instead to support code suggestion instead of committing whole changes w/o reviewdog?
If it just runs the formatter and don't need reviewdog, you should create a different action which doesn't require reviewdog and users should use the action instead.
You can refer to https://github.com/reviewdog/action-suggester
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haya14busa I now changed the action such that the formatting action is seperate from the annotation action. As a result, the formatting is only done when the user explicitly asks for the files to be formatted. Consequently, review dog only receives the unformatted output. What do you think about this implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haya14busa I agree that committing back the changes to the pull request or repository is bad practice. I use this feature to format + annotate the code while also creating a pull-request containing the formatted code. We can also remove the stefanzweifel/git-auto-commit-action action from the README and keep the peter-evans/create-pull-request action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, it's fine to create an action that format the file and use commit / pull-request actions, but in this case, you don't need to use reviewdog, so it should be better to create a separate repo.
Users can just install or run simple formatted action and then use commit / pull-request actions instead of using this reviewdog action.
My second point is that reviewdog supports code-suggestion based on diff (see action-suggester for example as written above), so if you want to support this feature, I'm very much welcome to have such feature in reviewdog actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haya14busa Ah I see! I will revert the formatting related changes (both in this repository and in the action-black repository) and only add the new remark_flags
argument. I will try out if I can use the https://github.com/reviewdog/action-suggester with my actions and add a small note to this repository pointing to that action if people want to also autoformat their code.
The linting and formatting steps are now seperated such that the formatting output does not get passed to the reviewdog error parser.
🧪 Tests status: Successful (see rickstaa/action-test-repo#29) |
After a discussion with @haya14busa we decided to remove the formatting action again as this should be left inside a seperate repository (see reviewdog/action-remark-lint#25). This repository can be found on https://github.com/rickstaa/action-black.
@haya14busa I removed the formatting features and created a new pull request #31. |
* 🔥 Removes formatting feature After a discussion with @haya14busa we decided to remove the formatting action again as this should be left inside a seperate repository (see reviewdog/action-remark-lint#25). This repository can be found on https://github.com/rickstaa/action-black. * 💚 Removes formatting related gh-action tests * 🐛 Fixes syntax errors that were marked by shellcheck * 🚀 Removes debugging statements * 📝 Updates README.md badges * 📝 Updates readme.md * 📝 Updates documentation * 🔥 Removes redundant code * 🐛 Fixes bash syntax bugs * 💚 Removes unnecessary test commands * 💥 Changes black_flags to black_args This commit changes the `black_flags` input argument to `black_args` as this better describes what it does. Additionally it contains some small bug fixes. * 💬 Fixes some spell errors * 🎨 Improves code structure
To this pull request, I added the ability also to format your code automatically. Further, I made the following changes:
🚀 Main features:
✨ Small features:
💥 Breaking change
remark_flags
argument for the more often used dockerargs
argument. This makes the action more in line with other docker GitHub actions and allows for cleaner code.