Skip to content

Don't trigger line-length on lines that are just a single unbreakable string followed by a space and a backslash #773

@taladar

Description

@taladar

It seems currently line-length is smart enough not to trigger when a line is just a single unbreakable string but if e.g. a yaml value is a shell script with line continuation backslashes after such a single unbreakable string it still triggers.

So, e.g. if we have a .gitlab-ci.yaml with

job:
  script:
    - |-
      curl \
        "https://very-long-unbreakable-url.example.net/just/some/more/filler/to/make/this/longer/and/longer/and/longer/and/longer"

this already does not trigger length but

job:
  script:
    - |-
      curl \
        "https://very-long-unbreakable-url.example.net/just/some/more/filler/to/make/this/longer/and/longer/and/longer/and/longer" \
       -o output.json

the very same line just with a shell line continuation at the end now does, even though our options to break it up have not really improved.

My suggestion would be to also automatically exclude lines like that from line-length lints, especially since white-listing individual lines in the middle of multi-line shell commands like that also does not really work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions