Skip to content

Commit

Permalink
Fix for code smells (#215)
Browse files Browse the repository at this point in the history
* Fixed code smells
* Fixed CSVFormat deprecations
* Switching to ci.jenkins.io
  • Loading branch information
a-st authored Feb 9, 2023
1 parent 0f63142 commit fe1eaf1
Show file tree
Hide file tree
Showing 20 changed files with 181 additions and 170 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/ci.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

15 changes: 9 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
properties([
buildDiscarder(logRotator(numToKeepStr: '10')),
buildDiscarder(logRotator(numToKeepStr: '5')),
disableConcurrentBuilds(abortPrevious: true)
])

node('maven-11') {
node('linux-amd64') {
stage('Checkout') {
infra.checkoutSCM()
}

stage('Build') {
timeout(30) {
def args = ['clean', 'install', '-Dmaven.test.skip=true', '-Dmaven.javadoc.skip=true', '-Dset.changelist']
withEnv(['PATH+LOCAL=/home/jenkins/.local/bin']) {
sh 'pip install --upgrade pip'
sh 'pip install -r requirements.txt'

def args = ['clean', 'install', '-Dmaven.javadoc.skip=true', '-Dset.changelist']
infra.runMaven(args, 11)
}
}

stage('Archive') {
// junit '**/target/surefire-reports/TEST-*.xml'
junit '**/target/surefire-reports/TEST-*.xml'
infra.prepareToPublishIncrementals()
}
}

infra.maybePublishIncrementals()
infra.maybePublishIncrementals()
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ public void evaluateInExpertMode(Run<?, ?> run, FilePath workspace, TaskListener
/*
* Create Report of evaluated constraints
*/
ConstraintReport cr = new ConstraintReport(ceList, run.getParent().getBuilds().get(0), persistConstraintLog);
ConstraintReport cr = new ConstraintReport(ceList, run.getParent().getBuilds().iterator().next(), persistConstraintLog);
logger.print(cr.getLoggerMsg());
/*
* Determine build result
Expand Down
56 changes: 34 additions & 22 deletions src/main/java/hudson/plugins/performance/PerformanceReportMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import hudson.util.ChartUtil;
import hudson.util.ChartUtil.NumberOnlyBuildLabel;
import hudson.util.DataSetBuilder;
import hudson.util.Graph;

import org.jfree.chart.JFreeChart;
import org.jfree.data.category.CategoryDataset;
Expand Down Expand Up @@ -124,8 +125,8 @@ protected PerformancePublisher getPublisher() {
if (build != null) {
Job<?, ?> job = build.getParent();
if (job instanceof AbstractProject) {
AbstractProject project = (AbstractProject) job;
Describable describable = project.getPublishersList().get(PerformancePublisher.class);
AbstractProject<?, ?> project = (AbstractProject<?, ?>) job;
Describable<?> describable = project.getPublishersList().get(PerformancePublisher.class);
return (describable != null) ? (PerformancePublisher) describable : null;
}
}
Expand Down Expand Up @@ -251,8 +252,12 @@ public void doRespondingTimeGraph(StaplerRequest request,
}
String legendLimit = request.getParameter("legendLimit");
int limit = (legendLimit != null && !legendLimit.isEmpty()) ? Integer.parseInt(legendLimit) : Integer.MAX_VALUE;
ChartUtil.generateGraph(request, response,
createRespondingTimeChart(dataSetBuilder.build(), limit), 400, 200);
new Graph(-1, 400, 200) {
@Override
protected JFreeChart createGraph() {
return createRespondingTimeChart(dataSetBuilder.build(), limit);
}
}.doPng(request, response);
}

public void doThroughputGraph(StaplerRequest request, StaplerResponse response) throws IOException {
Expand Down Expand Up @@ -287,8 +292,12 @@ public void doThroughputGraph(StaplerRequest request, StaplerResponse response)
dataSetBuilder.add(throughputReport.get(), Messages.ProjectAction_RequestsPerSeconds(), label);
}

ChartUtil.generateGraph(request, response,
createThroughputChart((dataSetBuilder.build())), 400, 200);
new Graph(-1, 400, 200) {
@Override
protected JFreeChart createGraph() {
return createThroughputChart((dataSetBuilder.build()));
}
}.doPng(request, response);
}

protected JFreeChart createThroughputChart(CategoryDataset dataset) {
Expand Down Expand Up @@ -337,8 +346,12 @@ public void doRespondingTimeGraphPerTestCaseMode(

String legendLimit = request.getParameter("legendLimit");
int limit = (legendLimit != null && !legendLimit.isEmpty()) ? Integer.parseInt(legendLimit) : Integer.MAX_VALUE;
ChartUtil.generateGraph(request, response,
createRespondingTimeChart(dataSetBuilder.build(), limit), 600, 200);
new Graph(-1, 600, 200) {
@Override
protected JFreeChart createGraph() {
return createRespondingTimeChart(dataSetBuilder.build(), limit);
}
}.doPng(request, response);
}

public void doErrorsGraph(StaplerRequest request, StaplerResponse response)
Expand Down Expand Up @@ -374,8 +387,12 @@ public void doErrorsGraph(StaplerRequest request, StaplerResponse response)
dataSetBuilderErrors.add(performanceReport.errorPercent(),
Messages.ProjectAction_Errors(), label);
}
ChartUtil.generateGraph(request, response,
createErrorsChart(dataSetBuilderErrors.build()), 400, 200);
new Graph(-1, 400, 200) {
@Override
protected JFreeChart createGraph() {
return createErrorsChart(dataSetBuilderErrors.build());
}
}.doPng(request, response);
}

protected JFreeChart createErrorsChart(CategoryDataset dataset) {
Expand Down Expand Up @@ -437,10 +454,13 @@ public void doSummarizerGraph(StaplerRequest request, StaplerResponse response)
}

}
ChartUtil.generateGraph(
request,
response,
createSummarizerChart(dataSetBuilderSummarizer.build()), 400, 200);

new Graph(-1, 400, 200) {
@Override
protected JFreeChart createGraph() {
return createSummarizerChart(dataSetBuilderSummarizer.build());
}
}.doPng(request, response);
}

protected JFreeChart createSummarizerChart(CategoryDataset dataset) {
Expand Down Expand Up @@ -504,14 +524,6 @@ public boolean accept(File dir, String name) {
//addPreviousBuildReports();
}

private void loadPreviousBuilds() {
Run<?, ?> prev = getBuild().getPreviousCompletedBuild();
while (prev != null) {
getReportMap(prev);
prev = prev.getPreviousCompletedBuild();
}
}

private void addPreviousBuildReports() {
for (Map.Entry<String, PerformanceReport> item : getPerformanceReportMap().entrySet()) {
PerformanceReport curReport = item.getValue();
Expand Down
Loading

0 comments on commit fe1eaf1

Please sign in to comment.