Skip to content

Commit

Permalink
fix: Fix lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Taewan Kim <t25.kim@samsung.com>
  • Loading branch information
tiokim committed Jun 4, 2024
1 parent 50bbb32 commit 5a86800
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ private ScanossJsonStructure getScanossJsonStructure(String content, LPVSFile fi
*/
private static Reader getReader(LPVSQueue webhookConfig) throws IOException {
return Files.newBufferedReader(
Paths.get(
LPVSFileUtil.getScanResultsJsonFilePath(webhookConfig)));
Paths.get(LPVSFileUtil.getScanResultsJsonFilePath(webhookConfig)));
}

/**
Expand Down
41 changes: 20 additions & 21 deletions src/test/java/com/lpvs/util/LPVSFileUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ public void testSaveGithubDiffs() {
GHPullRequestFileDetail detail = new GHPullRequestFileDetail();
ReflectionTestUtils.setField(detail, "filename", "I_am_a_file");
ReflectionTestUtils.setField(detail, "patch", "+ a\n- b\n@@ -8,7 +8,6 @@\n c");
assertEquals(expected,
assertEquals(
expected,
LPVSFileUtil.saveGithubDiffs(
new ArrayList<GHPullRequestFileDetail>() {
{
add(detail);
}
},
webhookConfig));
new ArrayList<GHPullRequestFileDetail>() {
{
add(detail);
}
},
webhookConfig));
}

@Test
Expand All @@ -56,14 +57,15 @@ public void testSaveGithubDiffsFileNameWithSlash() {
GHPullRequestFileDetail detail = new GHPullRequestFileDetail();
ReflectionTestUtils.setField(detail, "filename", "dir/I_am_a_file");
ReflectionTestUtils.setField(detail, "patch", "+ a\n- b\n@@ -8,7 +8,6 @@\n c");
assertEquals(expected,
assertEquals(
expected,
LPVSFileUtil.saveGithubDiffs(
new ArrayList<GHPullRequestFileDetail>() {
{
add(detail);
}
},
webhookConfig));
new ArrayList<GHPullRequestFileDetail>() {
{
add(detail);
}
},
webhookConfig));
}

@Test
Expand All @@ -74,7 +76,8 @@ public void testSaveGithubDiffsEmptyPatchLines() {
GHPullRequestFileDetail detail = new GHPullRequestFileDetail();
ReflectionTestUtils.setField(detail, "filename", "I_am_a_file");
ReflectionTestUtils.setField(detail, "patch", "");
assertEquals(expected,
assertEquals(
expected,
LPVSFileUtil.saveGithubDiffs(
new ArrayList<GHPullRequestFileDetail>() {
{
Expand Down Expand Up @@ -184,14 +187,10 @@ private static String getExpectedResultsPath() {
}

private static String getExpectedJsonFilePathWithPullRequestId() {
return getExpectedResultsPath()
+ File.separator
+ "123.json";
return getExpectedResultsPath() + File.separator + "123.json";
}

private static String getExpectedJsonFilePathWithCommitSHA() {
return getExpectedResultsPath()
+ File.separator
+ "aaaa.json";
return getExpectedResultsPath() + File.separator + "aaaa.json";
}
}

0 comments on commit 5a86800

Please sign in to comment.