Skip to content

Allow lines to be longer than 80 chars if they're unbreakable in comments #766

@JulienPalard

Description

@JulienPalard

A probably "a bit too general" title, to open the discussion, but here are the facts:

Sometimes, in docstring, we're dropping some URL to some specs / external doc / references, like:

 /**
  * Does something cool, blah blah, not so long line.
  *
  * We're using Wilson scoring because blah blah, see:
  * http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval
  */

As this block can be used to generate documentation (to PDF, HTML, ...) and also to be cool with editors that can transform links to buttons (clickable), there is no valid way to split those URLs.

So the dillema pops: What do we do here ?

So here are some proposals for rules like Generic.Files.LineLength.TooLong:

  • Rules may have an option to not complain if the too long line is an URL.
  • Rules may have an option to not complain about "probably unbreakable too long lines" typically those not containing any spaces but the leading ones (like "space * space" in a multiline docstring comment block).
  • What about discerning unbreakable "too long lines" from strings and for comments ? Allowing one but not the other as options ?

I'm personally not into allowing variables containing too long URLs, but why not ? But I'm a bit more into allowing comments block to contain long URLs and PHPCS not complaining about it.

See also this issue in Python's PEP8 checker: PyCQA/pycodestyle#242 for a similar discussions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions