-
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
GitConflictMarkerBear #1334
Comments
Hi, cool idea! |
@adhikasp It looks like you're new, have you tried doing the newcomer issues, first? |
Ah, I just found your first PR for coala, please finish that one first before you do this one, thanks <3 |
I am interested to work on this. |
@kaustubhhiware You can do this one, right away. Just do |
@yukiisbored the PR to this issue hasn't been updated since April, I think the assignee has abandoned it. I would like to work on this, seems like a cool bear. |
Reassigning due to inactivity. |
I'm a little confused about what this bear would do? |
that's it 👍 |
@Makman2 I wrote some logic to detect the possible merge conflicts. The merge conflicts are detected and printed as debug messages in the correct order but when I yield the results the first conflict appears at the last and the rest are ordered. class GitConflictBear(LocalBear):
def run(self, filename, file):
self.debug('Checking file', filename)
merge_conflict_starts = -1
merge_conflict_split = -1
merge_conflict_ends = -1
conflict_free_code = ''
local_commit = ''
remote_commit = ''
for line_number, line in enumerate(file):
if merge_conflict_starts == -1:
if line.startswith('<<<<<<< '):
merge_conflict_starts = line_number
else:
conflict_free_code += line
if merge_conflict_split == -1:
if line.startswith('========='):
merge_conflict_split = line_number
else:
conflict_free_code += line
if merge_conflict_ends == -1:
if line.startswith('>>>>>>> '):
merge_conflict_ends = line_number
else:
conflict_free_code += line
else:
self.debug(merge_conflict_starts+1, merge_conflict_split+1, merge_conflict_ends+1)
yield self.new_result(message="Possible merge conflict found between {} and {}"
.format(merge_conflict_starts+1, merge_conflict_ends+1), file=filename)(diffs)
merge_conflict_starts = -1
merge_conflict_ends = -1
merge_conflict_split = -1 Here's the coala output:
Shouldn't the conflict found at lines 4 and 9 be at the top?
|
Could you move such code discussions rather to the PR? Discussing implementation details on issues blasts the discussion log. |
Ok I'll make a half baked PR |
There should a bear to avoid left over git conflict markers to easily find these markers and avoid them from reaching production or being merged.
An example of a conflict marker generated by git:
The text was updated successfully, but these errors were encountered: