-
Notifications
You must be signed in to change notification settings - Fork 1
[Enhancement] Automated Source Code Optimisation #8
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
Comments
The basic options are:
All of them have their pros and cons. The minimal solution would be a Git alias whereas the Action would solve the problems automatically at the cost of a slightly higher maintenance effort. |
I actually don't really know all these options, which would you recommend and why? What are the differences between the approaches? |
With the Git alias, you define a pseudo-command for Git to execute. Just like
The cons are that
With a pre-commit check, you define a shell script to check your code and save this script in the
The cons are that
The GitHub Action is basically that what I suggested in #5. You just alter the file name, behaviour, required actions and permissions and so on, and it will enhance your commits automatically. The pros are that
The cons are that
|
Regarding the GitHub Action, what do you mean by
exactly? |
You need to pass a version information of the action you are about to apply. This might happen by naming the branch's identifier ( Only with the latter method, you can be sure that you do not receive updates without any further notice. Something bad that might happen with your workflow is that it breaks after an automatic update. So for every new version, you need to lookup its commit hash to intentionally install exactly the new version you want. ("updating manually") With "auditing" I mean that should take a look at the definition of the action to be sure that it does nothing in addition it should rather not do. You need to make sure that the action's behaviour is what you want and expect. This also correlates with the manual updates. |
I'm sorry, I still do not quite get it. I think I'll have to look at it myself some time. But I don't know when I'll have time for that.. 😅 |
The official GitHub Documentation on this topic, search for "Security Hardening", is a good starting point. I would like to suggest to leave this point open for one of the next Pull Requests. |
Yeah like I said, I think I will dig into this myself. I will also set it up in the process of understanding everything about it. 😄 I leave this issue open, until I got to it. |
When trying out this feature, remember to always set the |
Another important point: when pushing to a GitHub repository with at least one GitHub Action configured, you need the |
I found another option: a new sub-command for Cargo! This would be a standalone executable named I intended |
Hmm, actually I think, that would have a few drawbacks, since e.g. I personally often use |
The auto-commit behaviour was just an optional suggestion. You could opt-in this feature, if required, for instance. A new commit would also originate from an optimisation GitHub Action so basically, the tool would automate or somehow abbreviate the following common workflow with the same effects as the GitHub Action:
Committing or even just adding it to the staging area would become an optional service command depending on whether an according option is set. This is an advantage in contrast to the GitHub Action since you decide whether you commit or not whereas the GitHub Action would always commit. |
Working prototype: https://github.com/kevinmatthes/cargo-optimise. Install with |
https://github.com/kevinmatthes/cargo-optimise: now less chatty, by default. |
By the way: |
Yeah, I really have to look into that. But I will probably first try it out in some test repository. 😅 |
If you already installed |
It is possible to automate the application of both
cargo fmt
andcargo clippy --fix
to the source code. This issue is intended to discuss the options of realisation and the suggested implementation in further detail.The text was updated successfully, but these errors were encountered: