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
40 changes: 40 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu' # Alternative distribution options are available
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: chmod
run: chmod +x ./gradlew
- 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 sonar --info
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.eknoes.inofficialgolem.updater;

import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
Expand All @@ -17,6 +18,7 @@
import de.eknoes.inofficialgolem.FeedReaderContract;
import de.eknoes.inofficialgolem.FeedReaderDbHelper;
import de.eknoes.inofficialgolem.R;
import kotlin.Suppress;

import java.lang.ref.WeakReference;
import java.util.Date;
Expand Down Expand Up @@ -140,6 +142,7 @@ protected void onPostExecute(GolemFetcher.FETCH_STATE finished) {
}
}

@SuppressLint("Range")
private void writeArticles(List<GolemItem> articles, boolean insertNew) {
for (GolemItem item : articles) {
if (isCancelled() || db == null) {
Expand Down
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ buildscript {
}
}

plugins {
id "org.sonarqube" version "4.4.1.3373"
}

sonar {
properties {
//TODO change this
property "sonar.projectKey", "Zusel_golem-android-reader"
property "sonar.organization", "main-org"
property "sonar.host.url", "https://sonarcloud.io"
}
}

allprojects {
repositories {
google()
Expand All @@ -29,6 +42,9 @@ allprojects {
}
}


tasks.register('clean', Delete) {
delete rootProject.buildDir
}


3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=false
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1024m "-XX:MaxMetaspaceSize=512m"