Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP AnnotationBear: return precise string/comment info #1323

Closed
wants to merge 5 commits into from

Conversation

aptrishu
Copy link
Member

No description provided.

@gitmate-bot
Copy link
Collaborator

Thanks for your contribution!

Reviewing pull requests take really a lot of time and we're all volunteers. Please make sure you go through the following check list and complete them all before pinging someone for a review.

As you learn things over your Pull Request please help others on the chat and on PRs to get their stuff right as well!

position)
if ret_val:
_range, end_position = ret_val[0], ret_val[1]
selected_end_annotation = "\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -223,7 +223,7 @@
                                         annotations[annotation],
                                         position)
                 else:
-                    selected_end_annotation = "\n"
+                    selected_end_annotation = '\n'
                     end_position = func(file,
                                         filename,
                                         text,

singleline_string = namedtuple("singleline_string", fields)
multiline_string = namedtuple("multiline_string", fields)
singleline_comment = namedtuple("singleline_string", fields)
multiline_comment = namedtuple("multiline_string", fields)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -110,7 +110,7 @@
         singleline_string = namedtuple("singleline_string", fields)
         multiline_string = namedtuple("multiline_string", fields)
         singleline_comment = namedtuple("singleline_string", fields)
-        multiline_comment = namedtuple("multiline_string", fields)
+        multiline_comment = namedtuple('multiline_string', fields)
         position = 0
         while position <= len(text):
 

" content_range full_range")
singleline_string = namedtuple("singleline_string", fields)
multiline_string = namedtuple("multiline_string", fields)
singleline_comment = namedtuple("singleline_string", fields)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -109,7 +109,7 @@
                   " content_range full_range")
         singleline_string = namedtuple("singleline_string", fields)
         multiline_string = namedtuple("multiline_string", fields)
-        singleline_comment = namedtuple("singleline_string", fields)
+        singleline_comment = namedtuple('singleline_string', fields)
         multiline_comment = namedtuple("multiline_string", fields)
         position = 0
         while position <= len(text):

fields = ("start_delimiter_range end_delimiter_range"
" content_range full_range")
singleline_string = namedtuple("singleline_string", fields)
multiline_string = namedtuple("multiline_string", fields)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -108,7 +108,7 @@
         fields = ("start_delimiter_range end_delimiter_range"
                   " content_range full_range")
         singleline_string = namedtuple("singleline_string", fields)
-        multiline_string = namedtuple("multiline_string", fields)
+        multiline_string = namedtuple('multiline_string', fields)
         singleline_comment = namedtuple("singleline_string", fields)
         multiline_comment = namedtuple("multiline_string", fields)
         position = 0

multiline_comment_range = []
fields = ("start_delimiter_range end_delimiter_range"
" content_range full_range")
singleline_string = namedtuple("singleline_string", fields)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -107,7 +107,7 @@
         multiline_comment_range = []
         fields = ("start_delimiter_range end_delimiter_range"
                   " content_range full_range")
-        singleline_string = namedtuple("singleline_string", fields)
+        singleline_string = namedtuple('singleline_string', fields)
         multiline_string = namedtuple("multiline_string", fields)
         singleline_comment = namedtuple("singleline_string", fields)
         multiline_comment = namedtuple("multiline_string", fields)

singleline_comment_range = []
multiline_comment_range = []
fields = ("start_delimiter_range end_delimiter_range"
" content_range full_range")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -106,7 +106,7 @@
         singleline_comment_range = []
         multiline_comment_range = []
         fields = ("start_delimiter_range end_delimiter_range"
-                  " content_range full_range")
+                  ' content_range full_range')
         singleline_string = namedtuple("singleline_string", fields)
         multiline_string = namedtuple("multiline_string", fields)
         singleline_comment = namedtuple("singleline_string", fields)

multiline_string_range = []
singleline_comment_range = []
multiline_comment_range = []
fields = ("start_delimiter_range end_delimiter_range"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -105,7 +105,7 @@
         multiline_string_range = []
         singleline_comment_range = []
         multiline_comment_range = []
-        fields = ("start_delimiter_range end_delimiter_range"
+        fields = ('start_delimiter_range end_delimiter_range'
                   " content_range full_range")
         singleline_string = namedtuple("singleline_string", fields)
         multiline_string = namedtuple("multiline_string", fields)

content = {"singleline strings": ranges[0],
"multiline strings": ranges[1],
"singleline comments": ranges[2],
"multiline comments": ranges[3]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -66,7 +66,7 @@
         content = {"singleline strings": ranges[0],
                    "multiline strings": ranges[1],
                    "singleline comments": ranges[2],
-                   "multiline comments": ranges[3]}
+                   'multiline comments': ranges[3]}
         yield HiddenResult(self, content)
 
     def find_annotation_ranges(self,

content = {'strings': string_ranges, 'comments': comment_ranges}
content = {"singleline strings": ranges[0],
"multiline strings": ranges[1],
"singleline comments": ranges[2],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -65,7 +65,7 @@
 
         content = {"singleline strings": ranges[0],
                    "multiline strings": ranges[1],
-                   "singleline comments": ranges[2],
+                   'singleline comments': ranges[2],
                    "multiline comments": ranges[3]}
         yield HiddenResult(self, content)
 

@@ -58,7 +63,10 @@ def run(self, filename, file, language: str, coalang_dir: str = None):
yield Result(self, str(e), severity=RESULT_SEVERITY.MAJOR,
affected_code=(e.code,))

content = {'strings': string_ranges, 'comments': comment_ranges}
content = {"singleline strings": ranges[0],
"multiline strings": ranges[1],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -64,7 +64,7 @@
                          affected_code=(e.code,))
 
         content = {"singleline strings": ranges[0],
-                   "multiline strings": ranges[1],
+                   'multiline strings': ranges[1],
                    "singleline comments": ranges[2],
                    "multiline comments": ranges[3]}
         yield HiddenResult(self, content)

@@ -58,7 +63,10 @@ def run(self, filename, file, language: str, coalang_dir: str = None):
yield Result(self, str(e), severity=RESULT_SEVERITY.MAJOR,
affected_code=(e.code,))

content = {'strings': string_ranges, 'comments': comment_ranges}
content = {"singleline strings": ranges[0],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -63,7 +63,7 @@
             yield Result(self, str(e), severity=RESULT_SEVERITY.MAJOR,
                          affected_code=(e.code,))
 
-        content = {"singleline strings": ranges[0],
+        content = {'singleline strings': ranges[0],
                    "multiline strings": ranges[1],
                    "singleline comments": ranges[2],
                    "multiline comments": ranges[3]}

comment_delimiter = dict(lang_dict['comment_delimiter'])
string_ranges = comment_ranges = ()
lang_dict["multiline_comment_delimiters"])
comment_delimiter = dict(lang_dict["comment_delimiter"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -48,7 +48,7 @@
             lang_dict['multiline_string_delimiters'])
         multiline_comment_delimiters = dict(
             lang_dict["multiline_comment_delimiters"])
-        comment_delimiter = dict(lang_dict["comment_delimiter"])
+        comment_delimiter = dict(lang_dict['comment_delimiter'])
         ranges = ((), (), (), ())
         try:
             ranges = self.find_annotation_ranges(

lang_dict['multiline_comment_delimiters'])
comment_delimiter = dict(lang_dict['comment_delimiter'])
string_ranges = comment_ranges = ()
lang_dict["multiline_comment_delimiters"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -47,7 +47,7 @@
         multiline_string_delimiters = dict(
             lang_dict['multiline_string_delimiters'])
         multiline_comment_delimiters = dict(
-            lang_dict["multiline_comment_delimiters"])
+            lang_dict['multiline_comment_delimiters'])
         comment_delimiter = dict(lang_dict["comment_delimiter"])
         ranges = ((), (), (), ())
         try:


with execute_bear(uut, "F", text) as result:
self.assertEqual(
result[0].contents["singleline strings"][0].full_range,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -151,7 +151,7 @@
 
         with execute_bear(uut, "F", text) as result:
             self.assertEqual(
-                result[0].contents["singleline strings"][0].full_range,
+                result[0].contents['singleline strings'][0].full_range,
                 test_range)
 
         text = ['''

with execute_bear(uut, 'F', text) as result:
self.assertEqual(result[0].contents['strings'], (test_range,))

with execute_bear(uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -149,7 +149,7 @@
             AbsolutePosition(text, 0),
             AbsolutePosition(text, text[0].find("'", 4)))
 
-        with execute_bear(uut, "F", text) as result:
+        with execute_bear(uut, 'F', text) as result:
             self.assertEqual(
                 result[0].contents["singleline strings"][0].full_range,
                 test_range)

self.assertIn(string2, results[0].contents['strings'])
self.assertIn(string3, results[0].contents['strings'])
self.assertEqual(results[0].contents['comments'], ())
with execute_bear(self.python_uut, "F", file_text) as results:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -122,7 +122,7 @@
                                     'F',
                                     AbsolutePosition(file_text, string3_start),
                                     AbsolutePosition(file_text, string3_end))
-        with execute_bear(self.python_uut, "F", file_text) as results:
+        with execute_bear(self.python_uut, 'F', file_text) as results:
             full_ranges = []
             for _result in (results[0].contents['singleline strings'] +
                             results[0].contents['multiline strings']):

"F",
AbsolutePosition(text, comment_start),
AbsolutePosition(text, comment_end))]
with execute_bear(self.python_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -87,7 +87,7 @@
                        "F",
                        AbsolutePosition(text, comment_start),
                        AbsolutePosition(text, comment_end))]
-        with execute_bear(self.python_uut, "F", text) as result:
+        with execute_bear(self.python_uut, 'F', text) as result:
             for _result in result[0].contents['singleline strings']:
                 self.assertEqual(_result.full_range, compare[0])
             for _result in result[0].contents['singleline comments']:

AbsolutePosition(text, string_start),
AbsolutePosition(text, string_end)),
SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -84,7 +84,7 @@
                        AbsolutePosition(text, string_start),
                        AbsolutePosition(text, string_end)),
                    SourceRange.from_absolute_position(
-                       "F",
+                       'F',
                        AbsolutePosition(text, comment_start),
                        AbsolutePosition(text, comment_end))]
         with execute_bear(self.python_uut, "F", text) as result:

self.assertEqual(result[0].contents['strings'], compare[0])
self.assertEqual(result[0].contents['comments'], compare[1])
compare = [SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -80,7 +80,7 @@
         string_start = ''.join(text).find("'")
         string_end = ''.join(text).find("'", string_start + 1)
         compare = [SourceRange.from_absolute_position(
-                       "F",
+                       'F',
                        AbsolutePosition(text, string_start),
                        AbsolutePosition(text, string_end)),
                    SourceRange.from_absolute_position(

"F",
AbsolutePosition(text, text[0].find('/*')),
AbsolutePosition(text, len(''.join(text)) - 1))
with execute_bear(self.c_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -64,7 +64,7 @@
             "F",
             AbsolutePosition(text, text[0].find('/*')),
             AbsolutePosition(text, len(''.join(text)) - 1))
-        with execute_bear(self.c_uut, "F", text) as result:
+        with execute_bear(self.c_uut, 'F', text) as result:
             self.assertEqual(result[0].contents['singleline strings'], ())
             for _result in result[0].contents['multiline comments']:
                 self.assertEqual(_result.full_range, compare)

self.assertEqual(result[0].contents['comments'], compare)
text = ["some string /*within \n", "'multiline comment'*/"]
compare = SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -61,7 +61,7 @@
     def test_multiline_comment(self):
         text = ["some string /*within \n", "'multiline comment'*/"]
         compare = SourceRange.from_absolute_position(
-            "F",
+            'F',
             AbsolutePosition(text, text[0].find('/*')),
             AbsolutePosition(text, len(''.join(text)) - 1))
         with execute_bear(self.c_uut, "F", text) as result:

with execute_bear(self.c_uut, 'F', text) as result:
self.assertEqual(result[0].contents['strings'], ())
self.assertEqual(result[0].contents['comments'], compare)
text = ["some string /*within \n", "'multiline comment'*/"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -59,7 +59,7 @@
                 self.assertEqual(_result.full_range, compare)
 
     def test_multiline_comment(self):
-        text = ["some string /*within \n", "'multiline comment'*/"]
+        text = ['some string /*within \n', "'multiline comment'*/"]
         compare = SourceRange.from_absolute_position(
             "F",
             AbsolutePosition(text, text[0].find('/*')),

"F",
AbsolutePosition(text, text[0].find('#')),
AbsolutePosition(text, len(text[0]) - 1))
with execute_bear(self.python_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -53,7 +53,7 @@
             "F",
             AbsolutePosition(text, text[0].find('#')),
             AbsolutePosition(text, len(text[0]) - 1))
-        with execute_bear(self.python_uut, "F", text) as result:
+        with execute_bear(self.python_uut, 'F', text) as result:
             self.assertEqual(result[0].contents['singleline strings'], ())
             for _result in result[0].contents['singleline comments']:
                 self.assertEqual(_result.full_range, compare)

self.assertEqual(result[0].contents['comments'], compare)
text = ["some #coment with 'string'\n", "and next line"]
compare = SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -50,7 +50,7 @@
     def test_single_line_comment(self):
         text = ["some #coment with 'string'\n", "and next line"]
         compare = SourceRange.from_absolute_position(
-            "F",
+            'F',
             AbsolutePosition(text, text[0].find('#')),
             AbsolutePosition(text, len(text[0]) - 1))
         with execute_bear(self.python_uut, "F", text) as result:

comment_delimiter = dict(lang_dict['comment_delimiter'])
string_ranges = comment_ranges = ()
lang_dict["multiline_comment_delimiters"])
comment_delimiter = dict(lang_dict["comment_delimiter"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -48,7 +48,7 @@
             lang_dict['multiline_string_delimiters'])
         multiline_comment_delimiters = dict(
             lang_dict["multiline_comment_delimiters"])
-        comment_delimiter = dict(lang_dict["comment_delimiter"])
+        comment_delimiter = dict(lang_dict['comment_delimiter'])
         ranges = ((), (), (), ())
         try:
             ranges = self.find_annotation_ranges(

lang_dict['multiline_comment_delimiters'])
comment_delimiter = dict(lang_dict['comment_delimiter'])
string_ranges = comment_ranges = ()
lang_dict["multiline_comment_delimiters"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -47,7 +47,7 @@
         multiline_string_delimiters = dict(
             lang_dict['multiline_string_delimiters'])
         multiline_comment_delimiters = dict(
-            lang_dict["multiline_comment_delimiters"])
+            lang_dict['multiline_comment_delimiters'])
         comment_delimiter = dict(lang_dict["comment_delimiter"])
         ranges = ((), (), (), ())
         try:


with execute_bear(uut, "F", text) as result:
self.assertEqual(
result[0].contents["singleline strings"][0].full_range,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -151,7 +151,7 @@
 
         with execute_bear(uut, "F", text) as result:
             self.assertEqual(
-                result[0].contents["singleline strings"][0].full_range,
+                result[0].contents['singleline strings'][0].full_range,
                 test_range)
 
         text = ['''

with execute_bear(uut, 'F', text) as result:
self.assertEqual(result[0].contents['strings'], (test_range,))

with execute_bear(uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -149,7 +149,7 @@
             AbsolutePosition(text, 0),
             AbsolutePosition(text, text[0].find("'", 4)))
 
-        with execute_bear(uut, "F", text) as result:
+        with execute_bear(uut, 'F', text) as result:
             self.assertEqual(
                 result[0].contents["singleline strings"][0].full_range,
                 test_range)

self.assertIn(string2, results[0].contents['strings'])
self.assertIn(string3, results[0].contents['strings'])
self.assertEqual(results[0].contents['comments'], ())
with execute_bear(self.python_uut, "F", file_text) as results:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -122,7 +122,7 @@
                                     'F',
                                     AbsolutePosition(file_text, string3_start),
                                     AbsolutePosition(file_text, string3_end))
-        with execute_bear(self.python_uut, "F", file_text) as results:
+        with execute_bear(self.python_uut, 'F', file_text) as results:
             full_ranges = []
             for _result in (results[0].contents['singleline strings'] +
                             results[0].contents['multiline strings']):

"F",
AbsolutePosition(text, comment_start),
AbsolutePosition(text, comment_end))]
with execute_bear(self.python_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -87,7 +87,7 @@
                        "F",
                        AbsolutePosition(text, comment_start),
                        AbsolutePosition(text, comment_end))]
-        with execute_bear(self.python_uut, "F", text) as result:
+        with execute_bear(self.python_uut, 'F', text) as result:
             for _result in result[0].contents['singleline strings']:
                 self.assertEqual(_result.full_range, compare[0])
             for _result in result[0].contents['singleline comments']:

AbsolutePosition(text, string_start),
AbsolutePosition(text, string_end)),
SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -84,7 +84,7 @@
                        AbsolutePosition(text, string_start),
                        AbsolutePosition(text, string_end)),
                    SourceRange.from_absolute_position(
-                       "F",
+                       'F',
                        AbsolutePosition(text, comment_start),
                        AbsolutePosition(text, comment_end))]
         with execute_bear(self.python_uut, "F", text) as result:

self.assertEqual(result[0].contents['strings'], compare[0])
self.assertEqual(result[0].contents['comments'], compare[1])
compare = [SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -80,7 +80,7 @@
         string_start = ''.join(text).find("'")
         string_end = ''.join(text).find("'", string_start + 1)
         compare = [SourceRange.from_absolute_position(
-                       "F",
+                       'F',
                        AbsolutePosition(text, string_start),
                        AbsolutePosition(text, string_end)),
                    SourceRange.from_absolute_position(

"F",
AbsolutePosition(text, text[0].find('/*')),
AbsolutePosition(text, len(''.join(text)) - 1))
with execute_bear(self.c_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -64,7 +64,7 @@
             "F",
             AbsolutePosition(text, text[0].find('/*')),
             AbsolutePosition(text, len(''.join(text)) - 1))
-        with execute_bear(self.c_uut, "F", text) as result:
+        with execute_bear(self.c_uut, 'F', text) as result:
             self.assertEqual(result[0].contents['singleline strings'], ())
             for _result in result[0].contents['multiline comments']:
                 self.assertEqual(_result.full_range, compare)

self.assertEqual(result[0].contents['comments'], compare)
text = ["some string /*within \n", "'multiline comment'*/"]
compare = SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -61,7 +61,7 @@
     def test_multiline_comment(self):
         text = ["some string /*within \n", "'multiline comment'*/"]
         compare = SourceRange.from_absolute_position(
-            "F",
+            'F',
             AbsolutePosition(text, text[0].find('/*')),
             AbsolutePosition(text, len(''.join(text)) - 1))
         with execute_bear(self.c_uut, "F", text) as result:

with execute_bear(self.c_uut, 'F', text) as result:
self.assertEqual(result[0].contents['strings'], ())
self.assertEqual(result[0].contents['comments'], compare)
text = ["some string /*within \n", "'multiline comment'*/"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -59,7 +59,7 @@
                 self.assertEqual(_result.full_range, compare)
 
     def test_multiline_comment(self):
-        text = ["some string /*within \n", "'multiline comment'*/"]
+        text = ['some string /*within \n', "'multiline comment'*/"]
         compare = SourceRange.from_absolute_position(
             "F",
             AbsolutePosition(text, text[0].find('/*')),

"F",
AbsolutePosition(text, text[0].find('#')),
AbsolutePosition(text, len(text[0]) - 1))
with execute_bear(self.python_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -53,7 +53,7 @@
             "F",
             AbsolutePosition(text, text[0].find('#')),
             AbsolutePosition(text, len(text[0]) - 1))
-        with execute_bear(self.python_uut, "F", text) as result:
+        with execute_bear(self.python_uut, 'F', text) as result:
             self.assertEqual(result[0].contents['singleline strings'], ())
             for _result in result[0].contents['singleline comments']:
                 self.assertEqual(_result.full_range, compare)

self.assertEqual(result[0].contents['comments'], compare)
text = ["some #coment with 'string'\n", "and next line"]
compare = SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -50,7 +50,7 @@
     def test_single_line_comment(self):
         text = ["some #coment with 'string'\n", "and next line"]
         compare = SourceRange.from_absolute_position(
-            "F",
+            'F',
             AbsolutePosition(text, text[0].find('#')),
             AbsolutePosition(text, len(text[0]) - 1))
         with execute_bear(self.python_uut, "F", text) as result:

with execute_bear(self.python_uut, 'F', text) as result:
self.assertEqual(result[0].contents['strings'], ())
self.assertEqual(result[0].contents['comments'], compare)
text = ["some #coment with 'string'\n", "and next line"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -48,7 +48,7 @@
             self.assertEqual(result[0].contents['singleline comments'], ())
 
     def test_single_line_comment(self):
-        text = ["some #coment with 'string'\n", "and next line"]
+        text = ["some #coment with 'string'\n", 'and next line']
         compare = SourceRange.from_absolute_position(
             "F",
             AbsolutePosition(text, text[0].find('#')),

"F",
AbsolutePosition(text, 0),
AbsolutePosition(text, len(text[0])-2))
with execute_bear(self.python_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -42,7 +42,7 @@
             "F",
             AbsolutePosition(text, 0),
             AbsolutePosition(text, len(text[0])-2))
-        with execute_bear(self.python_uut, "F", text) as result:
+        with execute_bear(self.python_uut, 'F', text) as result:
             for _result in result[0].contents['multiline strings']:
                 self.assertEqual(_result.full_range, compare)
             self.assertEqual(result[0].contents['singleline comments'], ())

self.assertEqual(result[0].contents['strings'], compare)
self.assertEqual(result[0].contents['comments'], ())
compare = SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -39,7 +39,7 @@
     def test_multiline_string(self):
         text = ["'''multiline string, #comment within it'''\n"]
         compare = SourceRange.from_absolute_position(
-            "F",
+            'F',
             AbsolutePosition(text, 0),
             AbsolutePosition(text, len(text[0])-2))
         with execute_bear(self.python_uut, "F", text) as result:

"F",
AbsolutePosition(text, 0),
AbsolutePosition(text, len(text[0]) - 2))
with execute_bear(self.python_uut, "F", text) as result:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -27,7 +27,7 @@
             "F",
             AbsolutePosition(text, 0),
             AbsolutePosition(text, len(text[0]) - 2))
-        with execute_bear(self.python_uut, "F", text) as result:
+        with execute_bear(self.python_uut, 'F', text) as result:
             for _result in result[0].contents['singleline strings']:
                 self.assertEqual(_result.full_range, compare)
             self.assertEqual(result[0].contents['singleline comments'], ())

self.assertEqual(result[0].contents['strings'], compare)
self.assertEqual(result[0].contents['comments'], ())
compare = SourceRange.from_absolute_position(
"F",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -24,7 +24,7 @@
     def test_single_line_string(self):
         text = ["'from start till the end with #comments'\n", ]
         compare = SourceRange.from_absolute_position(
-            "F",
+            'F',
             AbsolutePosition(text, 0),
             AbsolutePosition(text, len(text[0]) - 2))
         with execute_bear(self.python_uut, "F", text) as result:

for comment in annotation_dict['comments']:
if(comment.start.line < line_nr + 1 and
comment.end.line >= line_nr + 1):
for comment in annotation_dict["comments"]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not use the preferred quotation marks.

QuotesBear, severity NORMAL, section python.

The issue can be fixed by applying the following patch:

--- a/bears/general/IndentationBear.py
+++ b/bears/general/IndentationBear.py
@@ -480,7 +480,7 @@
     while line_nr < len(file):
         valid = True
 
-        for comment in annotation_dict["comments"]:
+        for comment in annotation_dict['comments']:
             if(comment.full_range.start.line < line_nr + 1 and
                comment.full_range.end.line >= line_nr + 1):
                 valid = False

SourceRange.from_values(self.filename, 6, 1, 6, 37))
{'multiline strings': (
x(SourceRange.from_values(self.filename, 2, 1, 4, 3)))
,'singleline strings': (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ',''

PycodestyleBear (E231), severity NORMAL, section autopep8.

SourceRange.from_values(self.filename, 6, 1, 6, 37))
{'multiline strings': (
x(SourceRange.from_values(self.filename, 2, 1, 4, 3)))
,'singleline strings': (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E128 continuation line under-indented for visual indent'

PycodestyleBear (E128), severity NORMAL, section autopep8.

SourceRange.from_values(self.filename, 5, 1, 5, 30),
SourceRange.from_values(self.filename, 6, 1, 6, 37))
{'multiline strings': (
x(SourceRange.from_values(self.filename, 2, 1, 4, 3)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E203 whitespace before ',''

PycodestyleBear (E203), severity NORMAL, section autopep8.

@@ -32,15 +33,16 @@ def setUp(self):
""").splitlines(True)

self.filename = 'f'

x = namedtuple('x','full_range')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E231 missing whitespace after ',''

PycodestyleBear (E231), severity NORMAL, section autopep8.

SourceRange.from_values(self.filename, 5, 1, 5, 30),
SourceRange.from_values(self.filename, 6, 1, 6, 37))
{'multiline strings': (
x(SourceRange.from_values(self.filename, 2, 1, 4, 3)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not comply to PEP8.

PEP8Bear, severity NORMAL, section autopep8.

The issue can be fixed by applying the following patch:

--- a/tests/general/QuotesBearTest.py
+++ b/tests/general/QuotesBearTest.py
@@ -39,8 +39,7 @@
                 [HiddenResult(
                     'AnnotationBear',
                     {'multiline strings': (
-                        x(SourceRange.from_values(self.filename, 2, 1, 4, 3)))
-                    ,'singleline strings': (
+                        x(SourceRange.from_values(self.filename, 2, 1, 4, 3))), 'singleline strings': (
                         x(SourceRange.from_values(self.filename, 5, 1, 5, 30)),
                         x(SourceRange.from_values(self.filename, 6, 1, 6, 37)))
                      }

@@ -32,15 +33,16 @@ def setUp(self):
""").splitlines(True)

self.filename = 'f'

x = namedtuple('x','full_range')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code does not comply to PEP8.

PEP8Bear, severity NORMAL, section autopep8.

The issue can be fixed by applying the following patch:

--- a/tests/general/QuotesBearTest.py
+++ b/tests/general/QuotesBearTest.py
@@ -33,7 +33,7 @@
         """).splitlines(True)
 
         self.filename = 'f'
-        x = namedtuple('x','full_range')
+        x = namedtuple('x', 'full_range')
         self.dep_results = {
             'AnnotationBear':
                 [HiddenResult(

@jayvdb
Copy link
Member

jayvdb commented Jan 20, 2017

Please squash your commits into one commit!

@aptrishu
Copy link
Member Author

@jayvdb
Please check this PR
#1332
it's the same, just a bit clear..

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

1 similar comment
@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@aptrishu aptrishu closed this Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants