-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add analyser to detect remaining conflicts
When the trust exit code is set to false (by default), use the analyser to detect remaining conflicts. Fixes #11
- Loading branch information
Showing
8 changed files
with
225 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
import configparser | ||
import unittest | ||
|
||
from amtanalyser import * | ||
|
||
CFA_PATH = 'tests/unit/analyser/{0}.txt' | ||
|
||
|
||
class ConflictedFileAnalyserTest(unittest.TestCase): | ||
def test_file_without_conflicts(self): | ||
# Given | ||
analyser = ConflictedFileAnalyser() | ||
file_path = CFA_PATH.format('no_conflicts') | ||
|
||
# When | ||
remaining = analyser.has_remaining_conflicts(file_path) | ||
|
||
# Then | ||
self.assertEqual(remaining, False) | ||
|
||
def test_file_with_1_conflict(self): | ||
# Given | ||
analyser = ConflictedFileAnalyser() | ||
file_path = CFA_PATH.format('single_conflict') | ||
|
||
# When | ||
remaining = analyser.has_remaining_conflicts(file_path) | ||
|
||
# Then | ||
self.assertEqual(remaining, True) | ||
|
||
def test_file_with_3_conflict(self): | ||
# Given | ||
analyser = ConflictedFileAnalyser() | ||
file_path = CFA_PATH.format('three_conflicts') | ||
|
||
# When | ||
remaining = analyser.has_remaining_conflicts(file_path) | ||
|
||
# Then | ||
self.assertEqual(remaining, True) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
from amtutils import * | ||
|
||
|
||
class ConflictedFileAnalyser: | ||
""" | ||
""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def has_remaining_conflicts(self, file): | ||
with open(file, 'r') as f: | ||
for line in f: | ||
if line.startswith(CONFLICT_START) \ | ||
or line.startswith(CONFLICT_SEP) \ | ||
or line.startswith(CONFLICT_BASE) \ | ||
or line.startswith(CONFLICT_END): | ||
return True | ||
|
||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus | ||
et magnis dis parturient montes, nascetur ridiculus mus. | ||
|
||
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, | ||
aliquet nec, vulputate eget, arcu. | ||
|
||
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras | ||
dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. | ||
|
||
Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. | ||
Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. | ||
|
||
Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, | ||
tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. | ||
|
||
Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut | ||
libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet | ||
nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus | ||
et magnis dis parturient montes, nascetur ridiculus mus. | ||
|
||
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, | ||
aliquet nec, vulputate eget, arcu. | ||
|
||
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras | ||
dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. | ||
|
||
<<<<<<< LOCAL | ||
Nulla purus tortor, ornare at dolor quis, maximus pharetra neque. Pellentesque eget felis et orci rhoncus tempor. Nulla auctor posuere | ||
nisl. Vivamus dignissim a nisl sit amet dapibus. | ||
||||||| | ||
======= | ||
Sed sodales eros non leo iaculis laoreet. Nulla et lobortis massa. Pellentesque sit amet suscipit augue. | ||
>>>>>>> REMOTE | ||
|
||
Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. | ||
Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. | ||
|
||
Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, | ||
tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. | ||
|
||
Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut | ||
libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet | ||
nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, |
Oops, something went wrong.