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

Fixing squid:S2275 -Fixing squid:UselessParenthesesCheck #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -83,7 +83,7 @@ protected final boolean isIncluded(Resource resource) {
protected Map<String, Integer> updateActivity (String resourceName, Map<String, Integer> fileStatus, String activity) {
Resource resource = createResource(resourceName);
LOG.warn(resource.getKey() + " is " + (isIncluded(resource) ? "NOT " : " ") + "excluded");
return (isIncluded(resource) ? MapUtils.updateMap(fileStatus, activity) : fileStatus);
return isIncluded(resource) ? MapUtils.updateMap(fileStatus, activity) : fileStatus;
}

Resource createResource(String resourceName) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sonar/plugins/scmstats/HgScmAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private List<HgChangeset> getHgChangeLog() {
LOG.info("Getting change log information for %s\n", baseDir.getAbsolutePath());
if (!hgRepo.initFrom(baseDir)) {
throw new HgRepositoryNotFoundException(
String.format("Can't find repository in: %s\n",baseDir.getAbsolutePath()));
String.format("Can't find repository in: %s%n",baseDir.getAbsolutePath()));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@misgersameer this change seems incorrect, and is unrelated to redundant parentheses

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%n should be used in place of \n to produce the platform-specific line separator

more info can be found at https://dev.eclipse.org/sonar/rules/show/squid:S2275

}
HgLogCommand cmd = hgRepo.createLogCommand();
return cmd.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected Map<String, CommitsList> updateAuthorActivity(
authorActivity.putAll(map);

final Map<String, Integer> activity = changeLogInfo.getActivity();
List<Integer> stats = (authorActivity.get(author) == null ? getInitialActivity(activity) : authorActivity.get(author).getCommits());
List<Integer> stats = authorActivity.get(author) == null ? getInitialActivity(activity) : authorActivity.get(author).getCommits();

if (authorActivity.containsKey(author)) {
final Integer commits = stats.get(0) + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.sonar.api.BatchExtension;

public class UrlChecker implements BatchExtension {
public static final String PARAMETER_MESSAGE = String.format("SCM Stats Plugin will not run.Please check the parameter SCM URL or the <scm> section of Maven pom.");
public static final String PARAMETER_MESSAGE = "SCM Stats Plugin will not run.Please check the parameter SCM URL or the <scm> section of Maven pom.";
public static final String FAILURE_BLANK = "SCM URL must not be blank";
public static final String FAILURE_FORMAT = "URL does not respect the SCM URL format described in http://maven.apache.org/scm/scm-url-format.html: [%s]";
public static final String FAILURE_NOT_SUPPORTED = "Unsupported SCM: [%s]. Check compatibility at http://docs.codehaus.org/display/SONAR/SCM+Stats+Plugin";
Expand Down