Skip to content

Commit

Permalink
Appease go report card
Browse files Browse the repository at this point in the history
  • Loading branch information
mkchoi212 committed Jun 1, 2018
1 parent 16b474b commit 5511c42
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions conflict/conflict.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ type Conflict struct {
BottomPeek int
}

// Represents user's conflict resolution decision
const (
Local = 1
Incoming = 2
)

// ErrInvalidManualInput is thrown when the manual code editing session
// results in deletion of the conflict markers in the text
var ErrInvalidManualInput = errors.New("Newly edited code is invalid")

// Valid checks if the parsed conflict has corresponding begin, separator,
Expand Down
2 changes: 1 addition & 1 deletion conflict/conflict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestHighlight(t *testing.T) {
err := f.Read()
testhelper.Ok(t, err)

conflicts, err := ExtractConflictsIn(f)
conflicts, err := ExtractConflicts(f)
if test.shouldPass {
testhelper.Ok(t, err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion conflict/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestWriteChanges(t *testing.T) {
}

// Exract conflicts and resolve them
conflicts, err := ExtractConflictsIn(f)
conflicts, err := ExtractConflicts(f)
testhelper.Ok(t, err)
for i := range test.resolveDecision {
conflicts[i].Choice = test.resolveDecision[i]
Expand Down
8 changes: 6 additions & 2 deletions conflict/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ func GroupConflictMarkers(lines []string) (conflicts []Conflict, err error) {
return conflicts, nil
}

func ExtractConflictsIn(f File) (conflicts []Conflict, err error) {
// ExtractConflicts extracts all conflicts from the provided `File`
// It returns an error if it fails to parse the conflict markers
// and if syntax highlighting fatally fails
// TODO: Prevent crashes from syntax highlighting
func ExtractConflicts(f File) (conflicts []Conflict, err error) {
conflicts, err = GroupConflictMarkers(f.Lines)
if err != nil {
return
Expand Down Expand Up @@ -119,7 +123,7 @@ func Find(cwd string) (files []File, err error) {
return
}

conflicts, err := ExtractConflictsIn(file)
conflicts, err := ExtractConflicts(file)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion conflict/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestParseConflictsIn(t *testing.T) {
t.Error("ParseConflicts/Read failed")
}

_, err := ExtractConflictsIn(f)
_, err := ExtractConflicts(f)
if test.shouldPass {
testhelper.Assert(t, err == nil, "function should have succeeded")
} else {
Expand Down
1 change: 0 additions & 1 deletion testhelper/testhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ func Equals(tb testing.TB, exp, act interface{}) {
tb.FailNow()
}
}

0 comments on commit 5511c42

Please sign in to comment.