Skip to content

Commit

Permalink
Fixing Sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Sep 22, 2019
1 parent 3604767 commit 20ddd78
Show file tree
Hide file tree
Showing 40 changed files with 1,121 additions and 305 deletions.
4 changes: 0 additions & 4 deletions boms-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@

<name>Plugs :: BOM Parent</name>

<properties>
<project.rootdir>${project.basedir}/../..</project.rootdir>
</properties>

<modules>
<module>maven-plugin-bom</module>
</modules>
Expand Down
4 changes: 0 additions & 4 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,4 @@
<packaging>pom</packaging>

<name>Plugs :: Examples Parent</name>

<properties>
<project.rootdir>${project.basedir}/../..</project.rootdir>
</properties>
</project>
1 change: 0 additions & 1 deletion plug-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<name>Plugs :: Plug API</name>

<properties>
<project.rootdir>${project.basedir}/..</project.rootdir>
<unpack-manifestmf.skip>false</unpack-manifestmf.skip>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public static String getVersion() {

static String manuallyRead() {
List<URL> urls = Collections.list(tryToExecute(
() -> PlugsVersion.class
.getClassLoader()
() -> Thread.currentThread()
.getContextClassLoader()
.getResources("META-INF/MANIFEST.MF"),
"20190325:205203"
));
Expand Down
26 changes: 26 additions & 0 deletions plug-api/src/main/java/pl/wavesoftware/plugs/api/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2019 Wave Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @author <a href="mailto:[email protected]">Krzysztof Suszynski</a>
* @since 2019-01-03
*/
@ReturnTypesAreNonnullByDefault
@ParametersAreNonnullByDefault
package pl.wavesoftware.plugs.api;

import pl.wavesoftware.eid.api.ReturnTypesAreNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
1 change: 0 additions & 1 deletion plugs-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<name>Plugs :: Plugs Core</name>

<properties>
<project.rootdir>${project.basedir}/..</project.rootdir>
<unpack-manifestmf.skip>false</unpack-manifestmf.skip>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
* @author <a href="mailto:[email protected]">Krzysztof Suszynski</a>
* @since 2019-01-03
*/
@ReturnTypesAreNonnullByDefault
@ParametersAreNonnullByDefault
package pl.wavesoftware.plugs.core;

import pl.wavesoftware.eid.api.ReturnTypesAreNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
1 change: 0 additions & 1 deletion plugs-felix/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<name>Plugs :: Felix</name>

<properties>
<project.rootdir>${project.basedir}/..</project.rootdir>
<unpack-manifestmf.skip>false</unpack-manifestmf.skip>
</properties>

Expand Down
1 change: 0 additions & 1 deletion plugs-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<name>Plugs :: Spring Module</name>

<properties>
<project.rootdir>${project.basedir}/..</project.rootdir>
<unpack-manifestmf.skip>false</unpack-manifestmf.skip>
</properties>

Expand Down
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
</distributionManagement>

<properties>
<project.rootdir>${project.basedir}</project.rootdir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.host.url>https://sonarcloud.io/</sonar.host.url>
Expand All @@ -123,7 +122,7 @@
<dependency>
<groupId>org.apiguardian</groupId>
<artifactId>apiguardian-api</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
Expand Down Expand Up @@ -158,12 +157,12 @@
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>semver4j</artifactId>
<version>2.2.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.18</version>
<version>1.19</version>
</dependency>

<!-- Test -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ private MojoOr repackageAndReport(
logger.debug("Building of {} was successful.", coordinates.targetPath());
} catch (RepackageFailed ex) {
logger.error(
"Building of {} has failed: {}",
coordinates.targetPath(),
ex.getMessage()
"Building of {} has failed.", coordinates.targetPath()
);
throw new MojoExecutionException("Repackage FAILURE!", ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ final class MavenFilter implements Filter {
}

@Override
public Set<Artifact> filterDependencies(Set<Artifact> dependencies)
throws RepackageFailed {
public Set<Artifact> filterDependencies(Set<Artifact> dependencies) {
try {
return HashSet.ofAll(
filters.filter(dependencies.map(artifactMapper::mavenize).toJavaSet())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2019 Wave Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package pl.wavesoftware.plugs.tools.maven.plugin.mapper;

import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;

/**
* @author <a href="mailto:[email protected]">Krzysztof Suszynski</a>
* @since 0.1.0
*/
final class MavenInfo {
private final MavenProject mavenProject;
private final MavenSession mavenSession;

MavenInfo(MavenProject mavenProject, MavenSession mavenSession) {
this.mavenProject = mavenProject;
this.mavenSession = mavenSession;
}

MavenProject getMavenProject() {
return mavenProject;
}

MavenSession getMavenSession() {
return mavenSession;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package pl.wavesoftware.plugs.tools.maven.plugin.mapper;

import io.vavr.Lazy;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;
import org.slf4j.Logger;
import pl.wavesoftware.plugs.tools.packager.api.model.PackagerConfiguration;
import pl.wavesoftware.plugs.tools.packager.api.model.PackagerCoordinates;
Expand All @@ -35,8 +33,7 @@ final class MavenPackagerConfiguration implements PackagerConfiguration {

private final ArtifactMapper artifactMapper;
private final Logger logger;
private final MavenProject mavenProject;
private final MavenSession mavenSession;
private final MavenInfo mavenInfo;
private final Supplier<Project> project;
private final String classifier;
private final boolean attach;
Expand All @@ -47,17 +44,15 @@ final class MavenPackagerConfiguration implements PackagerConfiguration {
MavenPackagerConfiguration(
ArtifactMapper artifactMapper,
Logger logger,
MavenProject project,
MavenSession session,
MavenInfo mavenInfo,
String classifier,
boolean attach,
File outputDirectory,
String finalName
) {
this.artifactMapper = artifactMapper;
this.logger = logger;
this.mavenProject = project;
this.mavenSession = session;
this.mavenInfo = mavenInfo;
this.classifier = classifier;
this.attach = attach;
this.outputDirectory = outputDirectory;
Expand Down Expand Up @@ -89,8 +84,8 @@ public Project project() {
private Project calculateProject() {
return new MavenBackedProject(
artifactMapper,
mavenProject,
mavenSession,
mavenInfo.getMavenProject(),
mavenInfo.getMavenSession(),
outputDirectory.toPath(),
finalName,
classifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public PackagerConfiguration create(
File outputDirectory,
String finalName
) {
MavenInfo mavenInfo = new MavenInfo(project, session);
return new MavenPackagerConfiguration(
artifactMapper,
logger,
project,
session,
mavenInfo,
classifier,
attach,
outputDirectory,
Expand Down
Loading

0 comments on commit 20ddd78

Please sign in to comment.