Skip to content

Commit

Permalink
Merge pull request #2 from DigitalCampus/ci
Browse files Browse the repository at this point in the history
Run Ktlint before sonar
  • Loading branch information
AlbertoMoreta authored Oct 25, 2023
2 parents e4da4a5 + 70e5927 commit 92029e5
Show file tree
Hide file tree
Showing 31 changed files with 34 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
root = true

[*.{kt,kts}]
ktlint_standard_final-newline = disabled
# Disable here specific ktlint rules
#ktlint_standard_final-newline = disabled
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: GitHub Release

on:
push:
branches: master
tags:
- v*

Expand Down
6 changes: 4 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import com.android.build.gradle.internal.tasks.factory.dependsOn

plugins {
id("com.android.application")
Expand Down Expand Up @@ -116,13 +117,14 @@ dependencies {
ktlint {
android.set(true)
version.set("0.50.0")
ignoreFailures.set(false)
ignoreFailures.set(true)
reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.HTML)
}
}

tasks.sonar.dependsOn("ktlintCheck")
sonar {
properties {
property("sonar.projectName", "Oppia Mobile APP")
Expand All @@ -143,4 +145,4 @@ sonar {
property("sonar.junit.reportPaths", "**/test-results/**/*.xml")
property("sonar.coverage.jacoco.xmlReportPaths", "build/reports/coverage/androidTest/debug/connected/report.xml")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("org.digitalcampus.mobile.learning", appContext.packageName)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class App : Application()
class App : Application()
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ abstract class AppDatabase : RoomDatabase() {
abstract fun customFieldDao(): CustomFieldDao
abstract fun preferencesDao(): PreferencesDao
abstract fun courseDao(): CourseDao
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ interface BaseDao<T> {

@Delete
suspend fun deleteAll(list: List<T>): Int
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ interface CourseDao : BaseDao<CourseEntity> {

@Query("SELECT EXISTS(SELECT * FROM course WHERE shortname = :shortname)")
fun isInstalled(shortname: String): Boolean
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ interface UserDao : BaseDao<UserEntity> {

@Query("SELECT * FROM user WHERE username = :username")
suspend fun getByUsername(username: String): UserEntity?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ data class UserEntity(
)

val UserEntity.passwordEncrypted: String
get() = CryptoUtils.encryptLocalPassword(password)
get() = CryptoUtils.encryptLocalPassword(password)
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ interface AuthRemoteService {

@POST("user/")
suspend fun login(@Body loginRequest: LoginRequest): LoginResponse
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ data class LoginResponse(
val badging: Boolean,
@SerializedName("api_key")
val apiKey: String,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class UserDbDataSource @Inject constructor(private val userDao: UserDao) {
suspend fun updateUser(user: UserEntity) = userDao.update(user)

suspend fun getByUsername(username: String) = userDao.getByUsername(username)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ class UserRemoteDataSource @Inject constructor(private val authRemoteService: Au
response.apiKey,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ class UserRepository @Inject constructor(
}

suspend fun getLocalUserByUsername(username: String) = authDbDataSource.getByUsername(username)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class DateConverters {
fun dateToTimestamp(date: Date?): Long? {
return date?.time
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ class AppModule {
fun provideUserLoginLocalUseCase(userRepository: UserRepository) = UserLoginLocalUseCase(userRepository)

// TODO COMENTAR aquí se pueden llegar a crear muchísimos Provides, organizamos por funcionalidad o modelo?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import dagger.hilt.android.components.ViewModelComponent

@Module
@InstallIn(ViewModelComponent::class)
class ViewModelModule
class ViewModelModule
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package org.digitalcampus.oppiamobile.domain.useCases
class CheckFieldNotEmpty {

fun check(text: String?) = text?.isNotBlank() ?: false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ class UserLoginLocalUseCase @Inject constructor(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class UserLoginRemoteUseCase @Inject constructor(
Log.d("UserLoginRemoteUseCase", "doLogin: User: $user")
return user
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ class AuthActivity : AppCompatActivity() {
// FetchUserTask().updateLoggedUserProfile(this, apiEndpoint, user)
// finish()
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ class LoginFragment : AppFragment() {
// }
// }
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ class LoginViewModel @Inject constructor(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ class ActivityPagerAdapter(
updateTabLayout(tabs.getTabAt(i), R.layout.tablayout_fixed_tab, tabTitles[i])
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ open class AppFragment : Fragment() {

protected val isProgressDialogShowing: Boolean
get() = progressDialog != null && progressDialog!!.isShowing
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import androidx.lifecycle.ViewModel

open class AppViewModel : ViewModel() {
val TAG = this::class.simpleName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ class ConnectivityUtils(private val context: Context) {
return connectivityManager.activeNetworkInfo?.isConnected ?: false
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ object CryptoUtils {
}
return ""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,4 @@ object UIUtils {
// .setNegativeButton(context.getString(R.string.cancel), null)
// .show()
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}

0 comments on commit 92029e5

Please sign in to comment.