gitlint: tolerate long lines with URLs
When including referecnes to external resources using a URL, keep the line with URL in one line to not break the link and allow this to pass the gitlint test. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
f807d4db7e
commit
408a61d42b
1 changed files with 8 additions and 1 deletions
|
@ -78,5 +78,12 @@ class MaxLineLengthExceptions(LineRule):
|
||||||
|
|
||||||
def validate(self, line, _commit):
|
def validate(self, line, _commit):
|
||||||
max_length = self.options['line-length'].value
|
max_length = self.options['line-length'].value
|
||||||
if len(line) > max_length and not line.startswith('Signed-off-by'):
|
urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', line)
|
||||||
|
if line.startswith('Signed-off-by'):
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(urls) > 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(line) > max_length:
|
||||||
return [RuleViolation(self.id, self.violation_message.format(len(line), max_length), line)]
|
return [RuleViolation(self.id, self.violation_message.format(len(line), max_length), line)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue