Skip to content
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
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: SonarCloud
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonarqube --info

9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
plugins {
id "java-library"
id "com.github.johnrengelman.shadow" version "2.0.3" apply false
id "org.sonarqube" version "3.5.0.2730"
}

sonarqube {
properties {
property "sonar.projectKey", "viveknittmca_java-timeseries"
property "sonar.organization", "viveknittmca"
property "sonar.host.url", "https://sonarcloud.io"
}
}

compileJava {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ public static void plot(final TimeSeries timeSeries, final String title, final S
residualSeries.setXYSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter);
residualSeries.setMarker(new Circle()).setMarkerColor(Color.RED);

JPanel panel = new XChartPanel<>(chart);
JFrame frame = new JFrame(title);
JPanel panel = new XChartPanel<>(chart);

frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.add(panel);
frame.pack();
Expand All @@ -116,8 +117,9 @@ public static void plot(final TimeSeries timeSeries, final String title, final S
* @param k the maximum lag to include in the acf plot.
*/
public static void plotAcf(TimeSeries timeSeries, final int k) {
final double[] acf = timeSeries.autoCorrelationUpToLag(k);
final double[] lags = new double[k + 1];
final double[] acf = timeSeries.autoCorrelationUpToLag(k);

for (int i = 1; i < lags.length; i++) {
lags[i] = i;
}
Expand Down