Comment 1 for bug 1383662

Revision history for this message
Adi Roiban (adiroiban) wrote :

here is a preview... let me know if you agree on this bug and I can send a review request

diff --git a/pocketlint/formatcheck.py b/pocketlint/formatcheck.py
index afec408..e75dd8a 100755
--- a/pocketlint/formatcheck.py
+++ b/pocketlint/formatcheck.py
@@ -410,6 +410,9 @@ class AnyTextMixin:
         """Check the length of the line."""
         max_length = self.check_length_filter
         if len(line) > max_length:
+ # Ignore if line is long due to an URL.
+ if 'http://' in line or 'https://' in line:
+ return
             self.message(
                 line_no, 'Line exceeds %s characters.' % max_length,
                 icon='info')
diff --git a/pocketlint/tests/test_text.py b/pocketlint/tests/test_text.py
index 6a6f29d..56743aa 100644
--- a/pocketlint/tests/test_text.py
+++ b/pocketlint/tests/test_text.py
@@ -40,6 +40,18 @@ class TestAnyTextMixin:
             [(1, 'Line exceeds 80 characters.')],
             self.reporter.messages)

+ def test_long_length_http_exception(self):
+ """
+ Long line with http or https links are ignored.
+ """
+ long_line = '1234 http://some.url 56189' * 9
+ self.create_and_check('bogus', long_line)
+ self.assertEqual([], self.reporter.messages)
+
+ long_line = '1234 https://some.url 56189' * 9
+ self.create_and_check('bogus', long_line)
+ self.assertEqual([], self.reporter.messages)
+
     def test_no_trailing_whitespace(self):
         self.create_and_check('bogus', 'no trailing white-space')
         self.assertEqual([], self.reporter.messages)