Add space to separate comments from tokens #216

Manually merged
witten merged 1 commits from :comments-white-space into master 2019-09-18 21:03:56 +00:00
Contributor

https://yaml.org/spec/1.2/spec.html#id2780069

Seems like this is all that needs to be done, but not sure.

https://yaml.org/spec/1.2/spec.html#id2780069 Seems like this is all that needs to be done, but not sure.
Owner

Thanks for catching this! Would you mind updating the tests as well to reflect this change? The tests in question are in tests/integration/config/test_generate.py.

Thanks for catching this! Would you mind updating the tests as well to reflect this change? The tests in question are in `tests/integration/config/test_generate.py`.
Author
Contributor

Is there special handling that needs to be done to make sure commented blank lines don't turn into # ?

Edit: There's a space after # that isn't being rendered.

Is there special handling that needs to be done to make sure commented blank lines don't turn into `# `? Edit: There's a space after # that isn't being rendered.
Owner

Not sure. I don't see any cases in the generated config file (with your code changes in place) where blank lines get commented out. Is there somewhere you're seeing a blank line get commented?

Not sure. I don't see any cases in the generated config file (with your code changes in place) where blank lines get commented out. Is there somewhere you're seeing a blank line get commented?
polyzen reviewed 2019-09-18 00:04:09 +00:00
Author
Contributor

Is there somewhere you’re seeing a blank line get commented?

Here and below I had to do as such.

> Is there somewhere you’re seeing a blank line get commented? Here and below I had to do as such.
witten reviewed 2019-09-18 16:29:31 +00:00
Owner

Ah, gotcha! Okay, if you want to prevent commented-out blank lines from ending up with a space after the #, you can change the commenting-out logic a bit. I'll add a note where you can do that above.

Ah, gotcha! Okay, if you want to prevent commented-out blank lines from ending up with a space after the `#`, you can change the commenting-out logic a bit. I'll add a note where you can do that above.
witten reviewed 2019-09-18 16:31:24 +00:00
Owner

So, if you want to deal with the blank line situation, you could do something like this:

    if not line:
        return '#'
    elif not line.startswith(one_indent):
        return '# ' + line
So, if you want to deal with the blank line situation, you could do something like this: ```python if not line: return '#' elif not line.startswith(one_indent): return '# ' + line ```
polyzen reviewed 2019-09-18 17:24:30 +00:00
Author
Contributor

As there are no commented blank lines in the generated config, I thought the flexmock line in the tests had to be changed. Perhaps both?

As there are no commented blank lines in the generated config, I thought the flexmock line in the tests had to be changed. Perhaps both?
witten reviewed 2019-09-18 17:58:14 +00:00
Owner

It's really up to you. I could see either changing the tests as you already did, or changing the code to handle the blank line special case. Just let me know!

It's really up to you. I could see either changing the tests as you already did, or changing the code to handle the blank line special case. Just let me know!
polyzen reviewed 2019-09-18 20:33:56 +00:00
Author
Contributor

Making this change doesn't effect the outcome of the test, so I guess we're good to go here. 🤷

Making this change doesn't effect the outcome of the test, so I guess we're good to go here. 🤷
Owner

Looks good. Thanks for adding tests!

Looks good. Thanks for adding tests!
witten closed this pull request 2019-09-18 21:03:56 +00:00
witten closed this pull request 2019-09-18 21:03:56 +00:00
polyzen deleted branch comments-white-space 2019-09-18 22:12:29 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#216
No description provided.