[PATCH v3 0/2] checkpatch: fix false positive for COMMIT_LOG_LONG_LINE and provide fix

From: Aditya Srivastava
Date: Thu Jan 14 2021 - 02:36:28 EST


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(-)

--
2.17.1