Spawned from False positive on commented URLs (which as far as I can tell only applies to comment docblocks).

It is often extremely useful to record URLs of relevant software engineering tips alongside code using inline comments //

Sometime these URLs are longer than 80 chars, and trigger this:

WARNING | Line exceeds 80 characters; contains 87 characters

Example: the following URL (about type casting in PHP) is longer than 80 chars and triggers the above.

    // http://stackoverflow.com/questions/1147109/type-casting-for-user-defined-objects

My Coder review output on this educational tutorial module is currently fairly littered with the above WARNING, because I make frequent use in the code of such reference links, and they turn out to often be longer than 80 chars. I do not want to have to remove this useful and in some cases crucial information just to pass the Coder tests.

Please relax the rule to identify URLs via the http:// and https:// prefixes and permit URLs longer than 80 chars.

Such reference URLs do not always belong in a @link @endlink or a @see, they belong correctly in the code (usually under relevant code) not in doc blocks.

Comments

klausi’s picture

Component: Review/Rules » Coder Sniffer
Category: Feature request » Support request
Status: Active » Fixed

You should use "@see ", then Coder Sniffer will not complain. See https://www.drupal.org/node/1354#see

webel’s picture

Status: Fixed » Active

@klausi

Thanks for your feedback, but you don't seem to have understood my point at all, I am reopening this.

I am talking about inline comments in code, usually under code, referring to aspects of code.

There are not links for the docblock, and certainly not for @see (or for @link.)

Such links are used as reference within the code to information about the implementation and do not belong in the docblock.

webel’s picture

Title: Please permit long URL text in inline comments » Please permit long URL text in inline comments in the code area (not in the docblock)

  • klausi committed ea0a3a9 on 8.x-2.x
    Issue #2304873: Allow long URLs in inline comments.
    
klausi’s picture

Version: 7.x-2.2 » 8.x-2.x-dev
Category: Support request » Bug report
Status: Active » Fixed

Committed a fix to always allow text that does not contain spaces (like URLs) to exceed 80 characters.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

webel’s picture

thanks, i appreciate this fix.