-
Notifications
You must be signed in to change notification settings - Fork 581
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
AnnotationBear: Return precise string/comment info #1332
base: master
Are you sure you want to change the base?
Conversation
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! |
Comment on e017fa2. Body of HEAD commit contains too long lines. Commit body lines should not exceed 72 characters. GitCommitBear, severity NORMAL, section |
Comment on e017fa2. Shortlog of the HEAD commit contains 54 character(s). This is 4 character(s) longer than the limit (54 > 50). GitCommitBear, severity NORMAL, section |
78ae5cc
to
26ccdf8
Compare
CC @jayvdb. |
bears/general/AnnotationBear.py
Outdated
self.get_singleline_strings) | ||
if end_position and _range: | ||
strings_range.append(_range) | ||
end_position, start_delim, end_delim =\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a space after the equals, here and below
bears/general/AnnotationBear.py
Outdated
multiline_comment_range = [] | ||
fields = ('start_delimiter_range end_delimiter_range' | ||
' content_range full_range') | ||
singleline_string = namedtuple('singleline_string', fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with dict..
@jayvdb It's still failing, I have put namedtuples outside the class. |
775f009
to
2b2deff
Compare
All errors are resolved.. |
@aptrishu is this still wip? With that in the title you aren't getting any reviews and this is so important :( we need to merge it within hours |
Ohh I forgot to remove WIP from the tittle, Though I had labelled it |
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
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
tests/general/AnnotationBearTest.py
Outdated
AbsolutePosition(text, 0), | ||
AbsolutePosition(text, len(text[0]) - 2)) | ||
|
||
compare_content = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains unused source code.
PyUnusedCodeBear, severity NORMAL, section flakes
.
The issue can be fixed by applying the following patch:
--- a/tests/general/AnnotationBearTest.py
+++ b/tests/general/AnnotationBearTest.py
@@ -62,7 +62,6 @@
AbsolutePosition(text, 0),
AbsolutePosition(text, len(text[0]) - 2))
- compare_content = []
compare_start = SourceRange.from_absolute_position(
'F',
bears/general/AnnotationBear.py
Outdated
@@ -1,3 +1,5 @@ | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains unused source code.
PyUnusedCodeBear, severity NORMAL, section flakes
.
The issue can be fixed by applying the following patch:
--- a/bears/general/AnnotationBear.py
+++ b/bears/general/AnnotationBear.py
@@ -1,4 +1,3 @@
-import sys
from coalib.bearlib.languages.LanguageDefinition import LanguageDefinition
from coalib.bears.LocalBear import LocalBear
bears/general/AnnotationBear.py
Outdated
@@ -1,3 +1,5 @@ | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: flakes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmp255z_p7_/bears/general/AnnotationBear.py
+++ b/tmp/tmp255z_p7_/bears/general/AnnotationBear.py
@@ -1,4 +1,3 @@
-import sys
from coalib.bearlib.languages.LanguageDefinition import LanguageDefinition
from coalib.bears.LocalBear import LocalBear
tests/general/AnnotationBearTest.py
Outdated
AbsolutePosition(text, 0), | ||
AbsolutePosition(text, len(text[0]) - 2)) | ||
|
||
compare_content = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: flakes
.
The issue can be fixed by applying the following patch:
--- a/tmp/tmp255z_p7_/tests/general/AnnotationBearTest.py
+++ b/tmp/tmp255z_p7_/tests/general/AnnotationBearTest.py
@@ -62,7 +62,6 @@
AbsolutePosition(text, 0),
AbsolutePosition(text, len(text[0]) - 2))
- compare_content = []
compare_start = SourceRange.from_absolute_position(
'F',
fa5e192
to
e6468ee
Compare
Earlier the return used to be either a tuple of source ranges of strings/comments now it is a tuple of dicts with keys 'start_delimiter_range', 'end_delimiter_range' 'content_range', 'full_range' of singleline strings/multiline strings/singleline comments/multiline comments.
@Makman2 @userzimmermann review needed. :P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
for string_range in ranges: | ||
if (file[string_range.start.line-1][string_range.start.column-1] == | ||
temp_range = string_range.full_range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need to use a different variable here.
Earlier, do
- ranges = annotation_dict['strings']
+ ranges = [x.full_range for x in annotation_dict['strings']]
Earlier the return used to be either a tuple of
source ranges of strings/comments now it is a
tuple of namedtuples with fields
"start_delimiter_range end_delimiter_range content_range full_range"
of singleline strings/multiline strings/singlieline comments/multiline comments
Also, It modifies KeywordBear, QuotesBear,
IndentationBear and their tests.