From 6bef58e567bea7a11df2b0ef1ca331d583940778 Mon Sep 17 00:00:00 2001 From: Vyom-Yadav Date: Fri, 26 Aug 2022 21:07:04 +0530 Subject: [PATCH] Issue #614: Resolve MethodWithTooManyParameters, Naming, Javadoc IDEA violations --- .../main/java/com/github/checkstyle/Main.java | 4 ++-- .../com/github/checkstyle/MainProcess.java | 5 ++-- .../checkstyle/github/NotesBuilder.java | 4 +++- .../templates/TemplateProcessorTest.java | 24 +++++++++---------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/releasenotes-builder/src/main/java/com/github/checkstyle/Main.java b/releasenotes-builder/src/main/java/com/github/checkstyle/Main.java index 710f76f9..8c6157da 100644 --- a/releasenotes-builder/src/main/java/com/github/checkstyle/Main.java +++ b/releasenotes-builder/src/main/java/com/github/checkstyle/Main.java @@ -66,8 +66,8 @@ public static void main(String... args) { final Result notesBuilderResult = runGithubNotesBuilder(cliOptions); errorCounter = notesBuilderResult.getErrorMessages().size(); if (errorCounter == 0) { - publicationErrors = MainProcess.run(notesBuilderResult.getReleaseNotes(), - cliOptions); + publicationErrors = MainProcess.runPostGenerationAndPublication( + notesBuilderResult.getReleaseNotes(), cliOptions); } } } diff --git a/releasenotes-builder/src/main/java/com/github/checkstyle/MainProcess.java b/releasenotes-builder/src/main/java/com/github/checkstyle/MainProcess.java index 09a4e686..869ecde1 100644 --- a/releasenotes-builder/src/main/java/com/github/checkstyle/MainProcess.java +++ b/releasenotes-builder/src/main/java/com/github/checkstyle/MainProcess.java @@ -75,8 +75,9 @@ private MainProcess() { * @throws IOException if I/O error occurs. * @throws TemplateException if an error occurs while generating freemarker template. */ - public static List run(Multimap releaseNotes, - CliOptions cliOptions) throws IOException, TemplateException { + public static List runPostGenerationAndPublication( + Multimap releaseNotes, CliOptions cliOptions) + throws IOException, TemplateException { runPostGeneration(releaseNotes, cliOptions); return runPostPublication(cliOptions); } diff --git a/releasenotes-builder/src/main/java/com/github/checkstyle/github/NotesBuilder.java b/releasenotes-builder/src/main/java/com/github/checkstyle/github/NotesBuilder.java index 10d2a867..b8448011 100644 --- a/releasenotes-builder/src/main/java/com/github/checkstyle/github/NotesBuilder.java +++ b/releasenotes-builder/src/main/java/com/github/checkstyle/github/NotesBuilder.java @@ -131,7 +131,9 @@ public static Result buildResult(String localRepoPath, String authToken, String * @param commit commit information. * @param commitMessage commit message. * @throws IOException if an I/O error occurs. - * @throws GitAPIException if an error occurs when accessing Git API. + * @noinspection MethodWithTooManyParameters + * @noinspectionreason MethodWithTooManyParameters - Method requires a lot of parameters to + * build the result with label. */ private static void buildResultWithLabel(String remoteRepoPath, Result result, GHRepository remoteRepo, diff --git a/releasenotes-builder/src/test/java/com/github/checkstyle/templates/TemplateProcessorTest.java b/releasenotes-builder/src/test/java/com/github/checkstyle/templates/TemplateProcessorTest.java index 37cfa66e..0402382e 100644 --- a/releasenotes-builder/src/test/java/com/github/checkstyle/templates/TemplateProcessorTest.java +++ b/releasenotes-builder/src/test/java/com/github/checkstyle/templates/TemplateProcessorTest.java @@ -62,7 +62,7 @@ public void setup() throws IOException { @Test public void testGenerateOnlyBreakingCompatibility() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateAll(true).build()); @@ -77,7 +77,7 @@ public void testGenerateOnlyBreakingCompatibility() throws Exception { @Test public void testGenerateOnlyNewFeature() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(null, createAllNotes(), null, null, null), createBaseCliOptions() .setGenerateAll(true).build()); @@ -92,7 +92,7 @@ public void testGenerateOnlyNewFeature() throws Exception { @Test public void testGenerateOnlyBug() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(null, null, createAllNotes(), null, null), createBaseCliOptions() .setGenerateAll(true).build()); @@ -107,7 +107,7 @@ public void testGenerateOnlyBug() throws Exception { @Test public void testGenerateOnlyMisc() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(null, null, null, createAllNotes(), null), createBaseCliOptions() .setGenerateAll(true).build()); @@ -121,7 +121,7 @@ public void testGenerateOnlyMisc() throws Exception { @Test public void testGenerateOnlyNewModule() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(null, null, null, null, createAllNotes()), createBaseCliOptions() .setGenerateAll(true).build()); @@ -136,7 +136,7 @@ public void testGenerateOnlyNewModule() throws Exception { @Test public void testGenerateAll() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes( Collections.singletonList(createReleaseNotesMessage("Title 1", "Author 1")), Collections.singletonList(createReleaseNotesMessage(2, "Title 2", "Author 2")), @@ -156,7 +156,7 @@ public void testGenerateAll() throws Exception { @Test public void testGenerateOnlyXdoc() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateXdoc(true).build()); @@ -171,7 +171,7 @@ public void testGenerateOnlyXdoc() throws Exception { @Test public void testGenerateOnlyTwitter() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateTw(true).build()); @@ -186,7 +186,7 @@ public void testGenerateOnlyTwitter() throws Exception { @Test public void testGenerateOnlyRss() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateRss(true).build()); @@ -201,7 +201,7 @@ public void testGenerateOnlyRss() throws Exception { @Test public void testGenerateOnlyMlist() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateMlist(true).build()); @@ -216,7 +216,7 @@ public void testGenerateOnlyMlist() throws Exception { @Test public void testGenerateOnlyGitHub() throws Exception { - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateGitHub(true).build()); @@ -235,7 +235,7 @@ public void testGenerateCustomTemplate() throws Exception { FileUtils.writeStringToFile(file, "hello world"); final String template = file.getAbsolutePath(); - final List errors = MainProcess.run( + final List errors = MainProcess.runPostGenerationAndPublication( createNotes(createAllNotes(), createAllNotes(), createAllNotes(), createAllNotes(), createAllNotes()), createBaseCliOptions().setGenerateAll(true).setXdocTemplate(template)