-
Notifications
You must be signed in to change notification settings - Fork 224
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
Fixes #852 optionally add last newline #902
base: master
Are you sure you want to change the base?
Conversation
Thank you for your contribution. unfortunately, one or more of your commits are missing the required "Signed-off-by:" statement. Signing off is part of the Developer Certificate of Origin (DCO) which is used by this project. Read the DCO and project contributing guide carefully, and amend your commits using the git CLI. Note that this does not require any cryptography, keys or special steps to be taken. 💡 Shall we fix this?This will only take a few moments. First, clone your fork and checkout this branch using the git CLI. Next, set up your real name and email address:
Finally, run one of these commands to add the "Signed-off-by" line to your commits. If you only have one commit so far then run: Check that the message has been added properly by running "git log". |
@alexellis take a peek and let me know what you think? Once I have your 👍 on the fix itself, I'll proceed with unit tests. Thanks! |
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 didn't realise this would be as complicated as it's turned out. I'm leaving some comments.
Hi @alexellis this should ready for review now (no rush, just whenever you get a chance).
|
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.
Approved
@@ -423,3 +428,58 @@ func Test_getPrefixValue_Flag(t *testing.T) { | |||
t.Errorf("want %s, got %s", want, val) | |||
} | |||
} | |||
|
|||
func Test_addEofNewlines_works(t *testing.T) { |
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.
Where is this getting tested?
I'd expect something like if wantedYAML == os.ReadFile("stack.yml")
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.
Nice catch, I just added this. Let me know if anything else is needed?
Tested with Linux and Windows, by appending many new functions to a single stack.yml file. Signed-off-by: Kyle Brennan <[email protected]>
Description
Fixes #852
Motivation and Context
How Has This Been Tested?
So far, just manually, but will write unit tests after getting feedback on the fix.
Tested using the stack.yml file in this repo, ran iterations where it did not have trailing new lines, and did - both behave the same now.
Testing was done on Ubuntu; no Windows testing has been done yet.
I intentionally do this check early, in the same block as the other append checks, so that if we encounter an error while trying to fix the trailing new lines, we do not leave behind a handler folder.
Types of changes
Checklist:
git commit -s
(no, but I will, I look forward to Derek telling me abou tthis) 👍