Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonarlint source cleanups #320

Merged
merged 6 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.diff.DiffConfig;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.PersonIdent;
Expand Down Expand Up @@ -108,11 +107,10 @@ public GitLookup(File anyFile, DateSource dateSource, TimeZone timeZone, int che
*
* @param file for which the year should be retrieved
* @return year of last modification of the file
* @throws NoHeadException if unable to retrieve the head of the git history
* @throws IOException if unable to read the file
* @throws GitAPIException if unable to process the git history
*/
int getYearOfLastChange(File file) throws NoHeadException, GitAPIException, IOException {
int getYearOfLastChange(File file) throws GitAPIException, IOException {
String repoRelativePath = pathResolver.relativize(file);

if (isFileModifiedOrUnstaged(repoRelativePath)) {
Expand Down Expand Up @@ -161,7 +159,7 @@ int getYearOfCreation(File file) throws IOException, GitAPIException {
return commitYear;
}

String getAuthorNameOfCreation(File file) throws IOException, GitAPIException {
String getAuthorNameOfCreation(File file) throws IOException {
String repoRelativePath = pathResolver.relativize(file);
String authorName = "";
RevWalk walk = getGitRevWalk(repoRelativePath, true);
Expand All @@ -174,7 +172,7 @@ String getAuthorNameOfCreation(File file) throws IOException, GitAPIException {
return authorName;
}

String getAuthorEmailOfCreation(File file) throws IOException, GitAPIException {
String getAuthorEmailOfCreation(File file) throws IOException {
String repoRelativePath = pathResolver.relativize(file);
String authorEmail = "";
RevWalk walk = getGitRevWalk(repoRelativePath, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ private String[] buildExcludes(final LicenseSet licenseSet) {
List<String> ex = new ArrayList<>();
ex.addAll(asList(licenseSet.excludes));
if (project != null && project.getModules() != null && !aggregate) {
for (String module : (List<String>) project.getModules()) {
for (String module : project.getModules()) {
ex.add(module + "/**");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
*/
public final class Default {

private Default() {
// Prevent Instantiation
}

public static final String[] INCLUDE = new String[]{"**"};

public static final String[] EXCLUDES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public abstract class AbstractLicensePolicyEnforcer<T> implements LicensePolicyEnforcer<T> {
private final LicensePolicy policy;

public AbstractLicensePolicyEnforcer(final LicensePolicy policy) {
protected AbstractLicensePolicyEnforcer(final LicensePolicy policy) {
this.policy = policy;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
public class MavenProjectLicenses implements LicenseMap, LicenseMessage {

private Set<MavenProject> projects;
private MavenSession session;
private DependencyGraphBuilder graph;
private ProjectBuilder projectBuilder;
private ProjectBuildingRequest buildingRequest;
Expand Down Expand Up @@ -177,14 +176,6 @@ private Set<Artifact> getDependencies() {
// return project.getArtifacts();
}

private MavenSession getSession() {
return session;
}

private void setSession(MavenSession session) {
this.session = session;
}

protected Set<MavenProject> getProjects() {
return projects;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ private int findEndPosition() {
end = fileContent.getPosition();
line = fileContent.nextLine();
}
} if (headerDefinition.getEndLine().endsWith("EOL") && line != null && "".equals(line.trim())) {
}
if (headerDefinition.getEndLine().endsWith("EOL") && line != null && "".equals(line.trim())) {
end = fileContent.getPosition();
}
return end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static HeaderSource of(Multi multi, String inlineHeader, String headerPat
protected final String content;
private final boolean inline;

public HeaderSource(String content, boolean inline) {
protected HeaderSource(String content, boolean inline) {
super();
this.content = content;
this.inline = inline;
Expand Down