Skip to content

Commit 82086f6

Browse files
committed
fix cypher issue caused by too many semicolons
1 parent cfcd733 commit 82086f6

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ echo "Adding package to /user/local/bin/ ..."
55
sudo cp code2cypher /usr/local/bin/
66

77
echo "Running tests..."
8-
go test -v
8+
go test -v -cover

code2cypher.go

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func main() {
142142
fmt.Println(folderStructureToCypher(currentFile))
143143
}
144144
}
145+
fmt.Println(";")
145146

146147
if err != nil {
147148
log.Println(err)

cypherGenerator.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ func fileInfoToCypher(currentFile fileInfo, label string) string {
3737
"extension: '" + currentFile.Extension + "'")
3838
}
3939
properties += " }"
40-
return "CREATE (" + currentFile.Id + ":" + label + " " + properties + ");"
40+
return "CREATE (" + currentFile.Id + ":" + label + " " + properties + ")"
4141
}
4242

4343
// contributerToCypher returns a cypher statement to create node for a given contributer
4444
func contributerToCypher(contributerId, contributerName, contributerEmail string) string {
45-
return ("CREATE (" + contributerId + ":" + "person" + " { name: '" + contributerName + "', email: '" + contributerEmail + "' });")
45+
return ("CREATE (" + contributerId + ":" + "person" + " { name: '" + contributerName + "', email: '" + contributerEmail + "' })")
4646
}
4747

4848
// contributionToCypher returns to cypher statement to create a relationship between a file and a contributer
4949
func contributionToCypher(fileId, contributerId string) string {
50-
return "CREATE (" + fileId + ")<-[:EDITED]-(" + contributerId + ");"
50+
return "CREATE (" + fileId + ")<-[:EDITED]-(" + contributerId + ")"
5151
}
5252

5353
// folderStructureToCypher returns to cypher statement to create a relationship between a file and its parent folder
5454
func folderStructureToCypher(currentFile fileInfo) string {
55-
return "CREATE (" + currentFile.Id + ")-[:IN_FOLDER]->(" + currentFile.ParentId + ");"
55+
return "CREATE (" + currentFile.Id + ")-[:IN_FOLDER]->(" + currentFile.ParentId + ")"
5656
}

cypherGenerator_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ func TestFileInfoToCypher(t *testing.T) {
3030
{
3131
fileInfo { Id: "fileId", Name: "someDir", IsDir: true, },
3232
"testLabel",
33-
"CREATE (fileId:testLabel { name: 'someDir', url: '' });",
33+
"CREATE (fileId:testLabel { name: 'someDir', url: '' })",
3434
},
3535
{
3636
fileInfo { Name: "someDir", IsDir: true, Url: "https://github.com/someName/someRepo/tree/master/someDir" },
3737
"testLabel",
38-
"CREATE (:testLabel { name: 'someDir', url: 'https://github.com/someName/someRepo/tree/master/someDir' });",
38+
"CREATE (:testLabel { name: 'someDir', url: 'https://github.com/someName/someRepo/tree/master/someDir' })",
3939
},
4040
{
4141
fileInfo { Id: "fileId", Name: "someFile", IsDir: false, Size: 42, CommitCount: 23, ModTime: 111222333, Extension: "go" },
4242
"testLabel",
43-
"CREATE (fileId:testLabel { name: 'someFile', url: '', size: 42, commitCount: 23, lastModifiedDateTime: datetime({ epochseconds: 111222333 }), lastModifiedTimestamp: 111222333, extension: 'go' });",
43+
"CREATE (fileId:testLabel { name: 'someFile', url: '', size: 42, commitCount: 23, lastModifiedDateTime: datetime({ epochseconds: 111222333 }), lastModifiedTimestamp: 111222333, extension: 'go' })",
4444
},
4545
}
4646
for _, table := range testTables {
@@ -62,7 +62,7 @@ func TestContributerToCypher(t *testing.T) {
6262
"someId",
6363
"William T. Riker",
6464
65-
"CREATE (someId:person { name: 'William T. Riker', email: '[email protected]' });",
65+
"CREATE (someId:person { name: 'William T. Riker', email: '[email protected]' })",
6666
},
6767
}
6868
for _, table := range testTables {
@@ -82,7 +82,7 @@ func TestContributionToCypher(t *testing.T) {
8282
{
8383
"someFile_java",
8484
"William_T__Riker",
85-
"CREATE (someFile_java)<-[:EDITED]-(William_T__Riker);",
85+
"CREATE (someFile_java)<-[:EDITED]-(William_T__Riker)",
8686
},
8787
}
8888
for _, table := range testTables {
@@ -100,7 +100,7 @@ func TestFolderStructureToCypher(t *testing.T) {
100100
}{
101101
{
102102
fileInfo { Id: "someFileId", ParentId: "someParentId" },
103-
"CREATE (someFileId)-[:IN_FOLDER]->(someParentId);",
103+
"CREATE (someFileId)-[:IN_FOLDER]->(someParentId)",
104104
},
105105
}
106106
for _, table := range testTables {

0 commit comments

Comments
 (0)