[sonar] add impl

This commit is contained in:
zhongchao
2023-10-18 14:11:55 +08:00
parent 5043aa8c8f
commit f044cf9a2f
32 changed files with 93 additions and 125 deletions

View File

@@ -25,3 +25,19 @@ inspect java and kotlin codes:
except:
- master
allow_failure: true
sonarqube-check:
image: gradle:jre11-slim
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script: gradle sonarqube
allow_failure: true
only:
- merge_requests
- $CI_COMMIT_BRANCH
- pushes

View File

@@ -68,8 +68,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -64,7 +64,8 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.magic.mogo.och.charter">
<manifest package="com.magic.mogo.och.charter">
</manifest>

View File

@@ -62,7 +62,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.charter.passenger">
<manifest package="com.mogo.och.charter.passenger">
</manifest>

View File

@@ -1,24 +0,0 @@
package com.mogo.och.data
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mogo.och.data.test", appContext.packageName)
}
}

View File

@@ -1,17 +0,0 @@
package com.mogo.och.data
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.noop">
<manifest package="com.mogo.och.noop">
</manifest>

View File

@@ -74,7 +74,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mogo.och.bus.passenger">
<application>
<activity android:name="com.mogo.eagle.core.function.main.MainLauncherActivity"
android:screenOrientation="portrait"
tools:replace="android:screenOrientation"/>
</application>
</manifest>

View File

@@ -62,6 +62,8 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -62,6 +62,9 @@ dependencies {
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
androidTestImplementation rootProject.ext.dependencies.androidxjunit
testImplementation rootProject.ext.dependencies.junit
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,5 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.taxi">
/
<manifest package="com.mogo.och.taxi">
</manifest>

View File

@@ -8,9 +8,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Bus",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -8,9 +8,9 @@ project.android.productFlavors {
manifestPlaceholders = [
CHANNEL_VALUE_HEAD: "Charter",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识
buildConfigField 'String', 'APP_IDENTITY_MODE_HEAD', "\"Charter\""

View File

@@ -7,9 +7,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Noop",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -9,7 +9,7 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Shuttle",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
]
// ①标识

View File

@@ -7,9 +7,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Sweeper",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -7,9 +7,9 @@ project.android.productFlavors {
// 标识
CHANNEL_VALUE_HEAD: "Sweeper",
// 在启动的时候把Task给清空
ACTIVITY_ROOT : true,
// ACTIVITY_ROOT : true,
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识

View File

@@ -6,7 +6,7 @@ project.android.productFlavors {
manifestPlaceholders = [
CHANNEL_VALUE_HEAD: "Taxi",
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识
buildConfigField 'String', 'APP_IDENTITY_MODE_HEAD', "\"Taxi\""

View File

@@ -6,7 +6,7 @@ project.android.productFlavors {
manifestPlaceholders = [
CHANNEL_VALUE_HEAD: "Taxi",
// Activity的朝向
SCREEN_ORIENTATION:"landscape",
// SCREEN_ORIENTATION:"landscape",
]
// ①标识
buildConfigField 'String', 'APP_IDENTITY_MODE_HEAD', "\"Taxi\""

View File

@@ -15,13 +15,9 @@ buildscript {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven {
url "https://artifact.bytedance.com/repository/Volcengine/"
}
maven {
url "https://artifact.bytedance.com/repository/byteX/"
}
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://artifact.bytedance.com/repository/Volcengine/" }
maven { url "https://artifact.bytedance.com/repository/byteX/" }
gradlePluginPortal()
// mavenCentral()
google()
@@ -41,6 +37,7 @@ buildscript {
classpath "io.github.knight-zxw:lancet-plugin:${lancetx_plugin_version}"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0"
classpath 'com.mogo.cloud:matrix:1.0.0'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.4.0.2513'
// classpath 'com.bytedance.btrace:rhea-gradle-plugin:2.0.0'
}
// 遇无法更新依赖情况针对Snapshot无法刷新然后sync project即可刷新完成注释该代码
@@ -62,6 +59,7 @@ allprojects {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://plugins.gradle.org/m2/' }
// mavenCentral()
maven {
@@ -73,7 +71,7 @@ allprojects {
google()
}
if (isCodeInspectEnable ) {
if (isCodeInspectEnable) {
def basePath = new File(codequality, 'code_inspect_increment.gradle').path
apply from: "$basePath"
def pmdPath = new File(codequality, 'pmd.gradle').path
@@ -85,6 +83,9 @@ allprojects {
}
}
apply plugin: 'jacoco'
apply from: rootProject.file('codequality/sonar.gradle')
task clean(type: Delete) {
delete rootProject.buildDir
}

19
codequality/sonar.gradle Normal file
View File

@@ -0,0 +1,19 @@
apply plugin: 'org.sonarqube'
sonarqube {
properties {
property "sonar.log.level", "TRACE"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectKey", "MoGoEagleEyeTest"
property "sonar.sources", "src/main/java"
property "sonar.binaries", "build/intermediates/classes"
property "sonar.qualitygate.wait", true
property "sonar.android.lint.report", false
property "sonar.scm.exclusions.disabled", false
property "sonar.scm.exclusions.file", "**/.gitignore"
property "sonar.exclusions", "**/AndroidManifest.xml, **/src/test/**, **/*.jar, **/*.aar, **/*.war, **/*.ear, **/*.rar, **/*.tgz, **/*.zip, **/src/test/java/**/*.java, **/src/test/java/**/*.kt, **/test/**/*, **/*Test.java, **/*Tests.java, **/*Test.kt, **/*.xml,*.xml, **/target/**, **/src/main/java/proto/**, **/build/**, build, build/**, **/db/dao/*.java, **/build/intermediates/**/*"
// property "sonar.java.coveragePlugin", "jacoco"
// property("sonar.coverage.jacoco.xmlReportPaths", "../../build/reports/jacocoTestReport.xml,../build/reports/jacocoTestReport.xml")
}
}

View File

@@ -13,7 +13,7 @@ import com.zhjt.mogo_core_function_devatools.R
* @description Case清单列表适配器
* @since: 2022/10/19
*/
class CaseListAdapter: RecyclerView.Adapter<CaseListAdapter.CaseListHolder>() {
open class CaseListAdapter: RecyclerView.Adapter<CaseListAdapter.CaseListHolder>() {
private var data:List<RecordCaseEntity>? = null
private var caseClickListener: CaseClickListener?=null

View File

@@ -13,7 +13,7 @@ import com.zhjt.mogo_core_function_devatools.R
* @description Topic列表适配器
* @since: 2022/10/19
*/
class TopicListAdapter: RecyclerView.Adapter<TopicListAdapter.TopicListHolder>() {
open class TopicListAdapter: RecyclerView.Adapter<TopicListAdapter.TopicListHolder>() {
private var data:MutableList<TopicEntity>? = null
private var topicClickListener: TopicClickListener? = null

View File

@@ -54,14 +54,13 @@
-->
<activity
android:name="com.mogo.eagle.core.function.main.MainLauncherActivity"
android:clearTaskOnLaunch="${ACTIVITY_ROOT}"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:enabled="true"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:resizeableActivity="false"
android:screenOrientation="landscape"
android:resumeWhilePausing="true"
android:screenOrientation="${SCREEN_ORIENTATION}"
android:stateNotNeeded="true"
android:theme="@style/Main"
android:windowSoftInputMode="adjustPan|stateHidden">
@@ -122,10 +121,6 @@
<!-- </intent-filter>-->
</activity>
<meta-data
android:name="MAP_SDK_VERSION111111"
android:value="${MAP_SDK_VERSION}" />
<receiver android:name="com.mogo.eagle.core.function.hmi.receiver.V2XWarningBroadcastReceiver">
<intent-filter>
<action android:name="com.hmi.v2x.notification" />

View File

@@ -1,21 +0,0 @@
package com.mogo.launcer.patch
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class) class ExampleInstrumentedTest {
@Test fun useAppContext() { // Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mogo.launcer.patch.test", appContext.packageName)
}
}

View File

@@ -1,16 +0,0 @@
package com.mogo.launcer.patch
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -22,7 +22,8 @@ import java.security.MessageDigest;
public class DiskLruCacheManager {
private DiskLruCache diskLruCache;
private static DiskLruCacheManager instance;
private static volatile DiskLruCacheManager instance;
private static final byte[] obj = new byte[0];
private final int MAX_CACHE_SIZE = 64 * 1024 * 1024;
@@ -37,7 +38,7 @@ public class DiskLruCacheManager {
public static DiskLruCacheManager getInstance(Context context) {
if (instance == null) {
synchronized (DiskLruCacheManager.class) {
synchronized (obj) {
if (instance == null) {
instance = new DiskLruCacheManager(context.getApplicationContext());
}

View File

@@ -43,6 +43,9 @@ RELEASE_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-releases/
SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
USERNAME=xintai
PASSWORD=xintai2018
#sonar配置
systemProp.sonar.host.url=https://sonarqube.zhidaoauto.com
systemProp.sonar.login=8c54651afe55516ee11edaf3d2aec5e560577096
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
USE_MAVEN_PACKAGE=false
##plugin 插件

View File

@@ -918,7 +918,7 @@ public class LaneMarkTools {
return info;
}
//直行 + 左转 + 右转ֱ<EFBFBD><EFBFBD> + <20><>ת + <20><>ת
//直行 + 左转 + 右转
public BitmapInfo getRenderStraightAddLeftRightTurnLaneArrow(int isW)
{
int width = LANE_WIDTH;