Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use block scalars in YAML dumps #4702

Merged
merged 1 commit into from
Jan 23, 2023
Merged

Use block scalars in YAML dumps #4702

merged 1 commit into from
Jan 23, 2023

Conversation

sgsunder
Copy link
Contributor

@sgsunder sgsunder commented Jan 1, 2023

  • Your changes are not possible to do through a plugin and relevant
    to a large audience (ideally all users of OctoPrint)
  • If your changes are large or otherwise disruptive: You have
    made sure your changes don't interfere with current development by
    talking it through with the maintainers, e.g. through a
    Brainstorming ticket
  • Your PR targets OctoPrint's devel branch if it's a completely
    new feature, or maintenance if it's a bug fix or improvement of
    existing functionality for the current stable version (no PRs
    against master or anything else please)
  • Your PR was opened from a custom branch on your repository
    (no PRs from your version of master, maintenance, or devel
    please), e.g. dev/my_new_feature or fix/my_bugfix
  • Your PR only contains relevant changes: no unrelated files,
    no dead code, ideally only one commit - rebase and squash your PR
    if necessary!
  • Your changes follow the existing coding style
  • If your changes include style sheets: You have modified the
    .less source files, not the .css files (those are generated
    with lessc)
  • You have tested your changes (please state how!) - ideally you
    have added unit tests
  • You have run the existing unit tests against your changes and
    nothing broke
  • You have added yourself to the AUTHORS.md file :)

What does this PR do and why is it necessary?

This is a minor tweak that improves the look of multiline string values that are dumped as YAML. Most often, it makes GCODE scripts stored inline in the config.yaml file look much easier to read and to hand parse.

Before:

  bedlevelvisualizer:
    _config_version: 1
    command: M420 T0 V
    commands:
    - command: 'M190 R%(bedtemp)s

        G34

        G29'
      confirmation: true
      enabled_while_graphing: false
      enabled_while_printing: false

After:

  bedlevelvisualizer:
    _config_version: 1
    command: M420 T0 V
    commands:
    - command: |-
        M190 R%(bedtemp)s
        G34
        G29
      confirmation: true
      enabled_while_graphing: false
      enabled_while_printing: false

Both statements parse equivalently so it should not have any effect on functionality. This change is only intended to make it easier for humans to read and modify.

How was it tested? How can it be tested by the reviewer?

  • Ran pytest (Passed with no errors).
  • Ran against a copy of my personal config.yaml file. (No errors found).

Any background context you want to provide?

N/A

What are the relevant tickets if any?

No open issues could be found regarding this.

Screenshots (if appropriate)

N/A

Further notes

@github-actions github-actions bot added targets maintenance The PR targets the maintenance branch approved Issue has been approved by the bot or manually for further processing labels Jan 1, 2023
@foosel foosel self-assigned this Jan 16, 2023
@foosel foosel added this to the 1.9.0 milestone Jan 16, 2023
@foosel foosel merged commit 4334939 into OctoPrint:maintenance Jan 23, 2023
@foosel
Copy link
Member

foosel commented Jan 23, 2023

Thank you, that's a lovely QOL change!

@sgsunder sgsunder deleted the fix-yaml-scalar-blocks branch January 24, 2023 23:09
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
approved Issue has been approved by the bot or manually for further processing targets maintenance The PR targets the maintenance branch
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants