Skip to content

Commit 151b543

Browse files
authored
Merge pull request #7 from lopspower/feat_ktlint
[FEAT] Add ktlint
2 parents c56b267 + 13341fc commit 151b543

File tree

89 files changed

+159
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+159
-147
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
[*.{kt,kts}]
3+
max_line_length = 120
4+
insert_final_newline = true
5+
disabled_rules = import-ordering, no-wildcard-imports

.github/pull_request_template.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,17 @@ What types of changes does your code introduce?
66

77
- [ ] Bugfix (non-breaking change which fixes an issue)
88
- [ ] New feature (non-breaking change which adds functionality)
9-
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
9+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10+
11+
### Preparing a pull request for review
12+
Ensure your change is properly formatted by running:
13+
14+
```gradle
15+
$ ./gradlew ktlintCheck
16+
```
17+
18+
Please correct any failures before requesting a review by running:
19+
20+
```gradle
21+
$ ./gradlew ktlintFormat
22+
```

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ buildscript {
1717

1818
plugins {
1919
id "com.google.devtools.ksp" version "$kotlin_version-1.0.6"
20+
id "org.jlleitschuh.gradle.ktlint" version "10.3.0"
2021
}
2122

2223
apply from: 'dependencies.gradle'

data/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
id 'kotlin-android'
44
id 'kotlinx-serialization'
55
id 'com.google.devtools.ksp'
6+
id 'org.jlleitschuh.gradle.ktlint'
67
id 'com.github.ben-manes.versions'
78
id 'com.adarshr.test-logger'
89
}
@@ -34,6 +35,11 @@ android {
3435
}
3536
}
3637

38+
ktlint {
39+
verbose = true
40+
android = true
41+
}
42+
3743
dependencies {
3844
// MODULE
3945
implementation project(':domain')

data/src/androidTest/java/com/mikhaellopez/data/persistence/DatabaseFactoryTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ object DatabaseFactoryTest {
1010
// allowing main thread queries, just for testing
1111
.allowMainThreadQueries()
1212
.build()
13-
14-
}
13+
}

data/src/androidTest/java/com/mikhaellopez/data/persistence/dao/CardDaoTest.kt

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ open class CardDaoTest {
137137
assert(database.cardDao().insert(entity1) > 0)
138138
assert(database.cardDao().insert(entity2) > 0)
139139

140-
assert(database.cardDao().getAll().let {
141-
it.size == 2
142-
&& it[0].compareTo(entity1)
143-
&& it[1].compareTo(entity2)
144-
})
140+
assert(
141+
database.cardDao().getAll().let {
142+
it.size == 2 &&
143+
it[0].compareTo(entity1) &&
144+
it[1].compareTo(entity2)
145+
}
146+
)
145147
}
146148

147149
@Test
@@ -172,17 +174,16 @@ open class CardDaoTest {
172174

173175
private fun CardEntity?.compareTo(entity: CardEntity): Boolean =
174176
this?.run {
175-
name == entity.name
176-
&& frenchName == entity.frenchName
177-
&& japaneseName == entity.japaneseName
178-
&& type == entity.type
179-
&& rarity == entity.rarity
180-
&& pokemonNumber == entity.pokemonNumber
181-
&& picture == entity.picture
182-
&& illustrator == entity.illustrator
183-
&& wikiLink == entity.wikiLink
184-
&& number == entity.number
185-
&& isCheck == entity.isCheck
177+
name == entity.name &&
178+
frenchName == entity.frenchName &&
179+
japaneseName == entity.japaneseName &&
180+
type == entity.type &&
181+
rarity == entity.rarity &&
182+
pokemonNumber == entity.pokemonNumber &&
183+
picture == entity.picture &&
184+
illustrator == entity.illustrator &&
185+
wikiLink == entity.wikiLink &&
186+
number == entity.number &&
187+
isCheck == entity.isCheck
186188
} ?: false
187-
188-
}
189+
}

data/src/main/java/com/mikhaellopez/data/di/DataSourceModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ val koinDataSourceModules = listOf(
3636
ProcessorModule().module,
3737
MapperModule().module,
3838
repositoryModule
39-
)
39+
)

data/src/main/java/com/mikhaellopez/data/di/MapperModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import org.koin.core.annotation.Module
55

66
@Module
77
@ComponentScan("com.mikhaellopez.data.mapper")
8-
class MapperModule
8+
class MapperModule

data/src/main/java/com/mikhaellopez/data/di/NetModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import org.koin.core.annotation.Module
55

66
@Module
77
@ComponentScan("com.mikhaellopez.data.net")
8-
class NetModule
8+
class NetModule

data/src/main/java/com/mikhaellopez/data/di/ProcessorModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import org.koin.core.annotation.Module
55

66
@Module
77
@ComponentScan("com.mikhaellopez.data.persistence.processor")
8-
class ProcessorModule
8+
class ProcessorModule

0 commit comments

Comments
 (0)