[v3,0/2] checkpatch: fix false positive for COMMIT_LOG_LONG_LINE and provide fix
mbox series

Message ID 20210114073513.15773-1-yashsri421@gmail.com
Headers show
Series
  • checkpatch: fix false positive for COMMIT_LOG_LONG_LINE and provide fix
Related show

Message

Aditya Srivastava Jan. 14, 2021, 7:35 a.m. UTC
Currently, checkpatch gives COMMIT_LOG_LONG_LINE warning even for URL
lines, which should be avoided.

An evaluation over v5.6..v5.8 found that out of 1703 warnings reported
by this class, 161 are due to the line containg URLs. Out of these 161,
53 are due to lines where URL is the first non-whitespace character of
the line.

Fix this false positive by suggesting to prefix the URL with "Link:".
Also provide the fix option to the user.

* Applies perfectly on next-20210108

Changes in v2:
- Fix coding style ('} else {')
- Make the URL check follow RFC 3986 style
- Give warning only if the URL is first non-whitespace of the line
- Set $commit_log_long_line only for else case
- Fix the warning count with exact figures and according to first non-space char as URL

Changes in v3:
- Provide fix option for the warning
- Update the warning count with v5.6..v5.8
- Update regex with /^\s*[a-z][\w\.\+\-]*:\/\/\S+/i (earlier:  /^\s*\b[a-z][\w\.\+\-]*:\/\/\S+/i)

Aditya Srivastava (2):
  checkpatch: fix false positive for COMMIT_LOG_LONG_LINE with URLs
  checkpatch: add fix option for COMMIT_LOG_LONG_LINE with URLs

 scripts/checkpatch.pl | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)