-
Notifications
You must be signed in to change notification settings - Fork 580
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
Bears: Remove leading blank line option #2893
base: master
Are you sure you want to change the base?
Conversation
@@ -1,4 +1,3 @@ | |||
|
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 shouldn't a part of this PR.
|
||
if allow_leading_blanklines: | ||
start_line_of_file = 1 | ||
|
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.
Extra blank line.
Yes I am working on it , correcting things
…On Tue, 19 Mar 2019, 9:13 pm Amol Grover, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In tests/go/GoImportsBearTest.py
<#2893 (comment)>:
> @@ -1,4 +1,3 @@
-
This file shouldn't a part of this PR.
------------------------------
In bears/general/SpaceConsistencyBear.py
<#2893 (comment)>:
> + end_line = False
+ enumerated_zip_obj = zip(range(1, len(file) + 1),
+ file)
+ enumerated_tuple = tuple(enumerated_zip_obj)
+
+ for line_number, line in enumerated_tuple:
+ if replacement.strip() == '':
+ end_line = line_number
+ else:
+ break
+
+ return end_line
+
+ if allow_leading_blanklines:
+ start_line_of_file = 1
+
Extra blank line.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#2893 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AcS9hycqNdUoOdhmjtpV1_RhQaiLOvHQks5vYQW7gaJpZM4b7meF>
.
|
a8082f4
to
38bbcb6
Compare
Implemented a feature for spaceconsistencyBear that control the removal of blank lines. Closes coala#2207
dc61555
to
8362b9b
Compare
@li-boxuan please review this |
''' | ||
spacing_helper = SpacingHelper(indent_size) | ||
result_texts = [] | ||
additional_info_texts = [] | ||
|
||
for line_number, line in enumerate(file, start=1): | ||
def end_blanklines(): |
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.
The function name needs to be more meaningful.
end_line = line_number | ||
else: | ||
break | ||
return end_line |
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.
In your case, end_line
is either False or a number. I suggest not doing this.
I would have 2 functions, has_leading_blanklines()
and get_leading_blanklines_no()
or similar.
|
||
self.check_invalidity(self.uut, | ||
['\n', | ||
' \n', |
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.
From this test case, I cannot see whether the invalidity is due to a blank line (first line), or trailing white spaces (second line).
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.
You should also verify the error message.
@li-boxuan thanks for the review i will submit changes soon as possible, actually i am busy in making proposal |
hello |
Bears: Remove leading blank line option
Implemented a feature for spaceconsistencyBear
that control the removal of blank lines.
Closes #2207
For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!
Checklist
them.
individually. It is not sufficient to have "fixup commits" on your PR,
our bot will still report the issues for the previous commit.) You will
likely receive a lot of bot comments and build failures if coala does not
pass on every single commit!
After you submit your pull request, DO NOT click the 'Update Branch' button.
When asked for a rebase, consult coala.io/rebase
instead.
Please consider helping us by reviewing other peoples pull requests as well:
corobo mark wip <URL>
to get it outof the review queue.
The more you review, the more your score will grow at coala.io and we will
review your PRs faster!