Skip to content

Commit aab4ded

Browse files
committed
Revert "- Format code to adhere to Kotlin coding conventions and set max_line_length to 100 in .editorconfig."
This reverts commit 0a9e7a5.
1 parent 0a9e7a5 commit aab4ded

File tree

18 files changed

+85
-211
lines changed

18 files changed

+85
-211
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ insert_final_newline = false
77
ij_kotlin_packages_to_use_import_on_demand = false
88
ij_kotlin_allow_trailing_comma = true
99
ij_kotlin_allow_trailing_comma_on_call_site = true
10-
max_line_length = 100
10+
max_line_length = off
1111
ktlint_function_naming_ignore_when_annotated_with = Composable
1212
ktlint_standard_import-ordering = disabled
1313
ktlint_standard_no-empty-first-line-in-class-body = disabled

composeApp/build.gradle.kts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,16 @@ compose.desktop {
159159
}
160160
}
161161

162-
fun ApplicationDefaultConfig.setupBuildConfigFields(properties: Properties) {
162+
fun ApplicationDefaultConfig.setupBuildConfigFields(
163+
properties: Properties,
164+
) {
163165
fun secret(key: String): String = System.getenv(key) ?: properties.getProperty(key, "")
164166

165167
if (secret("OPEN_API_KEY").isEmpty()) {
166168
error("OPEN_API_KEY not set in local.properties")
167169
}
168170

169-
buildConfigField(
170-
type = "String",
171-
name = "OPEN_API_KEY",
172-
value = "\"${secret("OPEN_API_KEY")}\"",
173-
)
171+
buildConfigField(type = "String", name = "OPEN_API_KEY", value = "\"${secret("OPEN_API_KEY")}\"")
174172
}
175173

176174
fun getLocalProperties(): Properties {

composeApp/src/androidMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/previews/PreviewUtils.kt

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import com.developersbreach.kotlindictionarymultiplatform.data.detail.model.Sect
66
import com.developersbreach.kotlindictionarymultiplatform.data.detail.model.Syntax
77
import com.developersbreach.kotlindictionarymultiplatform.data.topic.model.Topic
88

9-
fun sampleCodeSnippet(): String =
10-
"""
9+
fun sampleCodeSnippet(): String = """
1110
fun greet(name: String): String {
1211
return "Hello, Sam!"
1312
}
@@ -17,42 +16,40 @@ fun topic() = "Smart Casts"
1716

1817
fun subtitle() = "Automatic casting of immutable values"
1918

20-
fun fakeTopicDetails() =
21-
KotlinTopicDetails(
22-
topicId = "smart-cast",
23-
topicName = "Smart Cast",
24-
intro = "Smart casting allows the compiler to automatically cast types.",
25-
syntax = Syntax(
26-
signature = "if (x is String) println(x.length)",
27-
notes = "Works only with immutable vars",
28-
),
29-
sections = listOf(
30-
Section(
31-
heading = "Why Use It?",
32-
content = "Because it’s safer and reduces boilerplate.",
33-
codeExamples = listOf(
34-
CodeExample(
35-
description = "Basic usage of smart cast",
36-
code = """
19+
fun fakeTopicDetails() = KotlinTopicDetails(
20+
topicId = "smart-cast",
21+
topicName = "Smart Cast",
22+
intro = "Smart casting allows the compiler to automatically cast types.",
23+
syntax = Syntax(
24+
signature = "if (x is String) println(x.length)",
25+
notes = "Works only with immutable vars",
26+
),
27+
sections = listOf(
28+
Section(
29+
heading = "Why Use It?",
30+
content = "Because it’s safer and reduces boilerplate.",
31+
codeExamples = listOf(
32+
CodeExample(
33+
description = "Basic usage of smart cast",
34+
code = """
3735
fun printLength(obj: Any) {
3836
if (obj is String) {
3937
println(obj.length) // Smart cast
4038
}
4139
}
42-
""".trimIndent(),
43-
),
40+
""".trimIndent(),
4441
),
4542
),
4643
),
47-
pitfalls = listOf("Doesn't work with mutable vars."),
48-
relatedTopics = listOf("Type Checking", "Safe Casts"),
49-
)
44+
),
45+
pitfalls = listOf("Doesn't work with mutable vars."),
46+
relatedTopics = listOf("Type Checking", "Safe Casts"),
47+
)
5048

51-
fun sampleTopicList(): List<Topic> =
52-
listOf(
53-
Topic("Smart Casts"),
54-
Topic("Null Safety"),
55-
Topic("Coroutines"),
56-
Topic("Lambdas"),
57-
Topic("Sealed Classes"),
58-
)
49+
fun sampleTopicList(): List<Topic> = listOf(
50+
Topic("Smart Casts"),
51+
Topic("Null Safety"),
52+
Topic("Coroutines"),
53+
Topic("Lambdas"),
54+
Topic("Sealed Classes"),
55+
)

composeApp/src/commonMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/data/topic/repository/TopicRepository.kt

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,23 @@ import arrow.core.Either
44
import com.developersbreach.kotlindictionarymultiplatform.data.topic.model.Topic
55

66
object TopicRepository {
7-
fun getTopics(): Either<Throwable, List<Topic>> =
8-
Either.catch {
9-
listOf(
10-
Topic("Variables"),
11-
Topic("Strings"),
12-
Topic("Functions"),
13-
Topic("Coroutines"),
14-
Topic("Classes"),
15-
Topic("Interfaces"),
16-
Topic("Objects"),
17-
Topic("Collections"),
18-
Topic("Null Safety"),
19-
Topic("Lambdas"),
20-
Topic("Higher-Order Functions"),
21-
Topic("Delegation"),
22-
Topic("Sealed Classes"),
23-
Topic("Generics"),
24-
Topic("Annotations"),
25-
)
26-
}
7+
fun getTopics(): Either<Throwable, List<Topic>> = Either.catch {
8+
listOf(
9+
Topic("Variables"),
10+
Topic("Strings"),
11+
Topic("Functions"),
12+
Topic("Coroutines"),
13+
Topic("Classes"),
14+
Topic("Interfaces"),
15+
Topic("Objects"),
16+
Topic("Collections"),
17+
Topic("Null Safety"),
18+
Topic("Lambdas"),
19+
Topic("Higher-Order Functions"),
20+
Topic("Delegation"),
21+
Topic("Sealed Classes"),
22+
Topic("Generics"),
23+
Topic("Annotations"),
24+
)
25+
}
2726
}

composeApp/src/commonMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/ui/navigation/AppNavigation.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import com.developersbreach.kotlindictionarymultiplatform.ui.screens.topic.Topic
1212
import org.koin.compose.viewmodel.koinViewModel
1313

1414
@Composable
15-
fun AppNavigation(startDestination: AppDestinations = AppDestinations.TopicList) {
15+
fun AppNavigation(
16+
startDestination: AppDestinations = AppDestinations.TopicList,
17+
) {
1618
val navController = rememberNavController()
1719
val actions = remember(navController) { NavigationAction(navController) }
1820

composeApp/src/commonMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/ui/screens/detail/CodeExampleBox.kt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ fun CodeExampleBox(
6060
Box(
6161
modifier = Modifier
6262
.fillMaxWidth()
63-
.background(
64-
MaterialTheme.colorScheme.onPrimaryContainer,
65-
RoundedCornerShape(8.dp),
66-
)
63+
.background(MaterialTheme.colorScheme.onPrimaryContainer, RoundedCornerShape(8.dp))
6764
.padding(6.dp),
6865
) {
6966
Row(
@@ -93,23 +90,13 @@ fun CodeExampleBox(
9390
.padding(4.dp),
9491
) {
9592
Icon(
96-
imageVector = if (copied) {
97-
Icons.Default.Check
98-
} else {
99-
Icons.Default.ContentCopy
100-
},
93+
imageVector = if (copied) Icons.Default.Check else Icons.Default.ContentCopy,
10194
contentDescription = stringResource(Res.string.copy),
10295
tint = MaterialTheme.colorScheme.onPrimary,
10396
)
10497
Spacer(modifier = Modifier.width(4.dp))
10598
Text(
106-
text = if (copied) {
107-
stringResource(
108-
Res.string.copied,
109-
)
110-
} else {
111-
stringResource(Res.string.copy)
112-
},
99+
text = if (copied) stringResource(Res.string.copied) else stringResource(Res.string.copy),
113100
fontSize = 12.sp,
114101
color = MaterialTheme.colorScheme.onPrimary,
115102
)

composeApp/src/commonMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/ui/screens/detail/DetailTopAppBar.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ fun DetailTopBar(title: String) {
3030
},
3131
navigationIcon = {
3232
IconButton(onClick = { /* TODO: Navigate back */ }) {
33-
Icon(
34-
Icons.AutoMirrored.Filled.ArrowBack,
35-
contentDescription = stringResource(Res.string.back),
36-
)
33+
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(Res.string.back))
3734
}
3835
},
3936
colors = TopAppBarDefaults.topAppBarColors(

composeApp/src/commonMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/ui/screens/detail/components/IntroductionSection.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import org.jetbrains.compose.resources.stringResource
1414

1515
@Composable
1616
fun IntroductionSection(topic: KotlinTopicDetails) {
17-
Text(
18-
stringResource(Res.string.introduction),
19-
style = MaterialTheme.typography.headlineLarge,
20-
color = MaterialTheme.colorScheme.onPrimary,
21-
)
17+
Text(stringResource(Res.string.introduction), style = MaterialTheme.typography.headlineLarge, color = MaterialTheme.colorScheme.onPrimary)
2218
Spacer(modifier = Modifier.height(4.dp))
2319
Text(text = topic.intro, style = MaterialTheme.typography.bodyMedium)
2420
}

composeApp/src/commonMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/ui/screens/detail/components/PitfallsSection.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,10 @@ import org.jetbrains.compose.resources.stringResource
1616
@Composable
1717
fun PitfallsSection(topic: KotlinTopicDetails) {
1818
if (topic.pitfalls.isNotEmpty()) {
19-
Text(
20-
stringResource(Res.string.pitfalls),
21-
style = MaterialTheme.typography.headlineLarge,
22-
color = MaterialTheme.colorScheme.onPrimary,
23-
)
19+
Text(stringResource(Res.string.pitfalls), style = MaterialTheme.typography.headlineLarge, color = MaterialTheme.colorScheme.onPrimary)
2420
Spacer(Modifier.height(4.dp))
2521
topic.pitfalls.forEach {
26-
Text(
27-
stringResource(Res.string.bullet_item, it),
28-
style = MaterialTheme.typography.bodyMedium,
29-
)
22+
Text(stringResource(Res.string.bullet_item, it), style = MaterialTheme.typography.bodyMedium)
3023
}
3124
Spacer(Modifier.height(16.dp))
3225
}

composeApp/src/commonMain/kotlin/com/developersbreach/kotlindictionarymultiplatform/ui/screens/detail/components/RelatedTopicsSection.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,10 @@ import org.jetbrains.compose.resources.stringResource
1616
@Composable
1717
fun RelatedTopicsSection(topic: KotlinTopicDetails) {
1818
if (topic.relatedTopics.isNotEmpty()) {
19-
Text(
20-
stringResource(Res.string.related_topics),
21-
style = MaterialTheme.typography.headlineLarge,
22-
color = MaterialTheme.colorScheme.onPrimary,
23-
)
19+
Text(stringResource(Res.string.related_topics), style = MaterialTheme.typography.headlineLarge, color = MaterialTheme.colorScheme.onPrimary)
2420
Spacer(Modifier.height(4.dp))
2521
topic.relatedTopics.forEach {
26-
Text(
27-
stringResource(Res.string.bullet_item, it),
28-
style = MaterialTheme.typography.bodyMedium,
29-
)
22+
Text(stringResource(Res.string.bullet_item, it), style = MaterialTheme.typography.bodyMedium)
3023
}
3124
}
3225
}

0 commit comments

Comments
 (0)