Allow long lines if they contain http links

Bug #1383662 reported by Adi Roiban on 2014-10-21
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pocket-lint
Undecided
Unassigned

Bug Description

In readme files or documentation (rst) files I need to insert http links. Some of them are very long and is not possible to break them.

I have a patch with ignore long lines with http or https links in them.

code exception is hardcoded and brutal but it does it job.

I will send to patch in case someone else find it useful

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)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers