Skip to content

Commit

Permalink
Correcting ReSharper och PyDocStyle (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre authored Oct 14, 2019
1 parent ff94f2e commit ebb2e86
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

Changelog of Violation Comments to Bitbucket Server Plugin.

## Unreleased
### GitHub [#67](https://github.com/jenkinsci/violation-comments-to-stash-plugin/pull/67) Use HTTPS URLs in pom.xml

**Use HTTPS URLs in pom.xml (#67)**


[ff94f2eff0c5858](https://github.com/jenkinsci/violation-comments-to-stash-plugin/commit/ff94f2eff0c5858) daniel-beck-bot *2019-10-08 11:46:55*


### No issue

**Create FUNDING.yml**


[aa2decab78598ba](https://github.com/jenkinsci/violation-comments-to-stash-plugin/commit/aa2decab78598ba) Tomas Bjerre *2019-09-28 06:53:03*


## 1.109
### No issue

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ A number of **parsers** have been implemented. Some **parsers** can parse output
| [_CPPLint_](https://github.com/theandrewdavis/cpplint) | `CPPLINT` |
| [_CSSLint_](https://github.com/CSSLint/csslint) | `CSSLINT` |
| [_Checkstyle_](http://checkstyle.sourceforge.net/) | `CHECKSTYLE` |
| [_CodeClimate_](https://codeclimate.com/) | `CODECLIMATE` |
| [_CodeNarc_](http://codenarc.sourceforge.net/) | `CODENARC` |
| [_Detekt_](https://github.com/arturbosch/detekt) | `CHECKSTYLE` | With `--output-format xml`.
| [_DocFX_](http://dotnet.github.io/docfx/) | `DOCFX` |
Expand All @@ -41,6 +42,7 @@ A number of **parsers** have been implemented. Some **parsers** can parse output
| [_GoVet_](https://golang.org/cmd/vet/) | `GOLINT` | Same format as GoLint.
| [_GolangCI-Lint_](https://github.com/golangci/golangci-lint/) | `CHECKSTYLE` | With `--out-format=checkstyle`.
| [_GoogleErrorProne_](https://github.com/google/error-prone) | `GOOGLEERRORPRONE` |
| [_HadoLint_](https://github.com/hadolint/hadolint/) | `CHECKSTYLE` | With `-f checkstyle`
| [_IAR_](https://www.iar.com/iar-embedded-workbench/) | `IAR` | With `--no_wrap_diagnostics`
| [_Infer_](http://fbinfer.com/) | `PMD` | Facebook Infer. With `--pmd-xml`.
| [_JCReport_](https://github.com/jCoderZ/fawkez/wiki/JcReport) | `JCREPORT` |
Expand Down Expand Up @@ -71,7 +73,7 @@ A number of **parsers** have been implemented. Some **parsers** can parse output
| [_SbtScalac_](http://www.scala-sbt.org/) | `SBTSCALAC` |
| [_Scalastyle_](http://www.scalastyle.org/) | `CHECKSTYLE` |
| [_Simian_](http://www.harukizaemon.com/simian/) | `SIMIAN` |
| [_Sonar_](https://www.sonarqube.org/) | `SONAR` | With `mvn sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.report.export.path=sonar-report.json`. Removed in 7.7, see [SONAR-11670](https://jira.sonarsource.com/browse/SONAR-11670).
| [_Sonar_](https://www.sonarqube.org/) | `SONAR` | With `mvn sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.report.export.path=sonar-report.json`. Removed in 7.7, see [SONAR-11670](https://jira.sonarsource.com/browse/SONAR-11670) but can be retrieved with: `curl --silent 'http://sonar-server/api/issues/search?componentKeys=unique-key&resolved=false' \| jq -f sonar-report-builder.jq > sonar-report.json`.
| [_Spotbugs_](https://spotbugs.github.io/) | `FINDBUGS` |
| [_StyleCop_](https://stylecop.codeplex.com/) | `STYLECOP` |
| [_SwiftLint_](https://github.com/realm/SwiftLint) | `CHECKSTYLE` | With `--reporter checkstyle`.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<findbugs.failOnError>false</findbugs.failOnError>
<maven.javadoc.skip>true</maven.javadoc.skip>
<violation-comments-lib>1.90</violation-comments-lib>
<violations-lib>1.96</violations-lib>
<violations-maven>1.19</violations-maven>
<violations-lib>1.106</violations-lib>
<violations-maven>1.29</violations-maven>
<changelog>1.60</changelog>
<fmt>2.9</fmt>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.jenkinsci.plugins.jvctb.perform.JvctbPerformer.jvctsPerform;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.FilePath;
import hudson.Launcher;
import hudson.ProxyConfiguration;
Expand Down Expand Up @@ -35,7 +36,7 @@ public class ViolationsToBitbucketServerRecorder extends Recorder implements Sim
public ViolationsToBitbucketServerRecorder() {}

@DataBoundConstructor
public ViolationsToBitbucketServerRecorder(ViolationsToBitbucketServerConfig config) {
public ViolationsToBitbucketServerRecorder(final ViolationsToBitbucketServerConfig config) {
this.config = config;
}

Expand All @@ -55,25 +56,26 @@ public BuildStepMonitor getRequiredMonitorService() {

@Override
public void perform(
@NonNull Run<?, ?> build,
@NonNull FilePath filePath,
@NonNull Launcher launcher,
@NonNull TaskListener listener)
@NonNull final Run<?, ?> build,
@NonNull final FilePath filePath,
@NonNull final Launcher launcher,
@NonNull final TaskListener listener)
throws InterruptedException, IOException {

ViolationsToBitbucketServerConfig combinedConfig =
final ViolationsToBitbucketServerConfig combinedConfig =
new ViolationsToBitbucketServerConfig(this.config);
ViolationsToBitbucketServerGlobalConfiguration defaults =
final ViolationsToBitbucketServerGlobalConfiguration defaults =
ViolationsToBitbucketServerGlobalConfiguration.get()
.or(new ViolationsToBitbucketServerGlobalConfiguration());

combinedConfig.applyDefaults(defaults);
ProxyConfigDetails proxyConfigDetails =
final ProxyConfigDetails proxyConfigDetails =
createProxyConfigDetails(listener.getLogger(), combinedConfig.getBitbucketServerUrl());
jvctsPerform(proxyConfigDetails, combinedConfig, filePath, build, listener);
}

/** The Jenkins.getInstance() will return null if not run on master! */
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
private ProxyConfigDetails createProxyConfigDetails(
final PrintStream logger, final String urlString) throws MalformedURLException {
final Jenkins jenkins = Jenkins.getInstance();
Expand Down Expand Up @@ -103,7 +105,7 @@ private ProxyConfigDetails createProxyConfigDetails(
final InetSocketAddress proxyAddr = (InetSocketAddress) addr;
final String proxyHost = proxyAddr.getAddress().getHostAddress();
final int proxyPort = proxyAddr.getPort();
ProxyConfigDetails proxyConfigDetails = new ProxyConfigDetails(proxyHost, proxyPort);
final ProxyConfigDetails proxyConfigDetails = new ProxyConfigDetails(proxyHost, proxyPort);

final String proxyUser = proxyConfig.getUserName();
if (proxyUser != null) {
Expand All @@ -116,7 +118,7 @@ private ProxyConfigDetails createProxyConfigDetails(
return proxyConfigDetails;
}

public void setConfig(ViolationsToBitbucketServerConfig config) {
public void setConfig(final ViolationsToBitbucketServerConfig config) {
this.config = config;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
import com.google.common.base.Optional;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.model.Item;
import hudson.model.Queue;
import hudson.model.queue.Tasks;
Expand All @@ -29,8 +30,10 @@

/* Read more about credentials api here: https://github.com/jenkinsci/credentials-plugin/blob/master/docs/consumer.adoc */
public class CredentialsHelper {
public static ListBoxModel doFillCredentialsIdItems(Item item, String credentialsId, String uri) {
StandardListBoxModel result = new StandardListBoxModel();
@SuppressFBWarnings("NP_NULL_PARAM_DEREF")
public static ListBoxModel doFillCredentialsIdItems(
final Item item, final String credentialsId, final String uri) {
final StandardListBoxModel result = new StandardListBoxModel();
if (item == null) {
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
return result.includeCurrentValue(credentialsId);
Expand All @@ -55,7 +58,7 @@ public static ListBoxModel doFillCredentialsIdItems(Item item, String credential
}

public static FormValidation doCheckFillCredentialsId(
Item item, String credentialsId, String uri) {
final Item item, final String credentialsId, final String uri) {
if (item == null) {
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
return FormValidation.ok();
Expand All @@ -69,14 +72,14 @@ public static FormValidation doCheckFillCredentialsId(
if (isNullOrEmpty(credentialsId)) {
return FormValidation.ok();
}
if (!(findCredentials(item, credentialsId, uri).isPresent())) {
if (!findCredentials(item, credentialsId, uri).isPresent()) {
return FormValidation.error("Cannot find currently selected credentials");
}
return FormValidation.ok();
}

public static Optional<StandardCredentials> findCredentials(
Item item, String credentialsId, String uri) {
final Item item, final String credentialsId, final String uri) {
if (isNullOrEmpty(credentialsId)) {
return absent();
}
Expand Down

0 comments on commit ebb2e86

Please sign in to comment.