Skip to content

Commit 5d754c3

Browse files
committed
Reformat sources with spotless
1 parent da969e2 commit 5d754c3

File tree

21 files changed

+46
-47
lines changed

21 files changed

+46
-47
lines changed

cli/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/cli/Main.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fun main(args: Array<String>) {
5050

5151
val html = HtmlReportGenerator(
5252
reportSpec = reportSpec,
53-
metricsProvider = ComposeCompilerMetricsProvider(rawReportProvider)
53+
metricsProvider = ComposeCompilerMetricsProvider(rawReportProvider),
5454
).generateHtml()
5555

5656
printHeader("Saving Composable Report")
@@ -89,43 +89,43 @@ class CliArguments(args: Array<String>, private val path: Path) {
8989
val applicationName by parser.option(
9090
ArgType.String,
9191
shortName = "app",
92-
description = "Application name (To be displayed in the report)"
92+
description = "Application name (To be displayed in the report)",
9393
).required()
9494

9595
val inputDirectory by parser.option(
9696
ArgType.String,
9797
shortName = "i",
98-
description = "Input directory where composable report and metrics are available"
98+
description = "Input directory where composable report and metrics are available",
9999
)
100100

101101
val overallStatsFile by parser.option(
102102
ArgType.String,
103103
shortName = "overallStatsReport",
104-
description = "Overall Statistics Metrics JSON files (separated by commas)"
104+
description = "Overall Statistics Metrics JSON files (separated by commas)",
105105
)
106106

107107
val detailedStatsFile by parser.option(
108108
ArgType.String,
109109
shortName = "detailedStatsMetrics",
110-
description = "Detailed Statistics Metrics CSV files (separated by commas)"
110+
description = "Detailed Statistics Metrics CSV files (separated by commas)",
111111
)
112112

113113
val composableMetricsFile by parser.option(
114114
ArgType.String,
115115
shortName = "composableMetrics",
116-
description = "Composable Metrics TXT files (separated by commas)"
116+
description = "Composable Metrics TXT files (separated by commas)",
117117
)
118118

119119
val classMetricsFile by parser.option(
120120
ArgType.String,
121121
shortName = "classMetrics",
122-
description = "Class Metrics TXT files (separated by commas)"
122+
description = "Class Metrics TXT files (separated by commas)",
123123
)
124124

125125
val outputDirectory by parser.option(
126126
ArgType.String,
127127
shortName = "o",
128-
description = "Output directory name"
128+
description = "Output directory name",
129129
).default(path.toAbsolutePath().toString())
130130

131131
init {
@@ -144,7 +144,7 @@ class CliArguments(args: Array<String>, private val path: Path) {
144144
overallStatsFile,
145145
detailedStatsFile,
146146
composableMetricsFile,
147-
classMetricsFile
147+
classMetricsFile,
148148
)
149149

150150
return if (directory != null) {
@@ -164,7 +164,7 @@ class CliArguments(args: Array<String>, private val path: Path) {
164164
briefStatisticsJsonFiles = files(overallStatsFile!!),
165165
detailedStatisticsCsvFiles = files(detailedStatsFile!!),
166166
composableReportFiles = files(composableMetricsFile!!),
167-
classesReportFiles = files(classMetricsFile!!)
167+
classesReportFiles = files(classMetricsFile!!),
168168
)
169169
}
170170

@@ -181,7 +181,7 @@ fun printHeader(header: String) = println(
181181
"""
182182
------------------------------------------------------------------
183183
$header
184-
""".trimIndent()
184+
""".trimIndent(),
185185
)
186186

187187
object Constants {

core/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/core/ComposeCompilerMetricsProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ interface ComposeCompilerMetricsProvider {
6464
*/
6565
@OptIn(ExperimentalStdlibApi::class)
6666
private class DefaultComposeCompilerMetricsProvider(
67-
private val contentProvider: ComposeMetricsContentProvider
67+
private val contentProvider: ComposeMetricsContentProvider,
6868
) : ComposeCompilerMetricsProvider {
6969

7070
override fun getOverallStatistics(): Map<String, Long> {
@@ -113,7 +113,7 @@ private class DefaultComposeCompilerMetricsProvider(
113113
* Factory function for creating [ComposeCompilerMetricsProvider].
114114
*/
115115
fun ComposeCompilerMetricsProvider(
116-
files: ComposeCompilerRawReportProvider
116+
files: ComposeCompilerRawReportProvider,
117117
): ComposeCompilerMetricsProvider {
118118
val contentProvider = ComposeMetricsContentProvider(files)
119119
return DefaultComposeCompilerMetricsProvider(contentProvider)

core/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/core/exception/ParsingException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ package dev.shreyaspatil.composeCompilerMetricsGenerator.core.exception
2626
class ParsingException(
2727
val content: String,
2828
cause: Throwable,
29-
message: String = "Error occurred while parsing the content"
29+
message: String = "Error occurred while parsing the content",
3030
) : RuntimeException(message, cause)

core/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/core/model/composables/ComposablesReport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import dev.shreyaspatil.composeCompilerMetricsGenerator.core.exception.ParsingEx
2727

2828
data class ComposablesReport(
2929
val composables: List<ComposableDetail>,
30-
val errors: List<ParsingException>
30+
val errors: List<ParsingException>,
3131
) {
3232
private val partitionedComposables by lazy { composables.partition { !it.isSkippable && it.isRestartable } }
3333

core/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/core/parser/ClassReportParser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ object ClassReportParser : Parser<String, ClassesReport> {
9191
stability = stability,
9292
runtimeStability = runtimeStability,
9393
fields = fields,
94-
rawContent = RawContent(classBody)
94+
rawContent = RawContent(classBody),
9595
)
9696
}
9797
}

core/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/core/parser/ComposableReportParser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ object ComposableReportParser : Parser<String, ComposablesReport> {
9393
isSkippable = isSkippable,
9494
isInline = isInline,
9595
params = params,
96-
rawContent = RawContent(function)
96+
rawContent = RawContent(function),
9797
)
9898
}
9999
}

gradle-plugin/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/plugin/ReportGenPlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ class ReportGenPlugin : Plugin<Project> {
7979
if (reportExtension.enableReport.get()) {
8080
freeCompilerArgs += listOf(
8181
"-P",
82-
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$outputPath"
82+
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$outputPath",
8383
)
8484
}
8585
if (reportExtension.enableMetrics.get()) {
8686
freeCompilerArgs += listOf(
8787
"-P",
88-
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$outputPath"
88+
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$outputPath",
8989
)
9090
}
9191
}

gradle-plugin/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/plugin/task/ComposeCompilerReportGenerateTask.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract class ComposeCompilerReportGenerateTask : DefaultTask() {
7373
"--rerun-tasks",
7474

7575
// Signal for enabling report generation in `kotlinOptions{}` block.
76-
"-P$KEY_ENABLE_REPORT_GEN=true"
76+
"-P$KEY_ENABLE_REPORT_GEN=true",
7777
)
7878
.run()
7979
}
@@ -86,13 +86,13 @@ abstract class ComposeCompilerReportGenerateTask : DefaultTask() {
8686
val reportSpec = ReportSpec(reportExtension.name.get())
8787

8888
val rawReportProvider = ComposeCompilerRawReportProvider.FromDirectory(
89-
directory = reportExtension.composeRawMetricsOutputDirectory
89+
directory = reportExtension.composeRawMetricsOutputDirectory,
9090
)
9191

9292
// Provide metric files to generator
9393
val htmlGenerator = HtmlReportGenerator(
9494
reportSpec = reportSpec,
95-
metricsProvider = ComposeCompilerMetricsProvider(rawReportProvider)
95+
metricsProvider = ComposeCompilerMetricsProvider(rawReportProvider),
9696
)
9797

9898
// Generate HTML (as String)

report-generator/src/main/kotlin/dev/shreyaspatil/composeCompilerMetricsGenerator/generator/HtmlReportGenerator.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ import kotlinx.html.stream.createHTML
4040
*/
4141
class HtmlReportGenerator(
4242
private val reportSpec: ReportSpec,
43-
private val metricsProvider: ComposeCompilerMetricsProvider
43+
private val metricsProvider: ComposeCompilerMetricsProvider,
4444
) {
4545
/**
4646
* Returns HTML content as a [String]
4747
*/
4848
fun generateHtml(): String = runBlocking(Dispatchers.Default) {
49-
5049
val deferredOverallStatistics = async {
5150
metricsProvider.getOverallStatistics().map { (name, value) -> camelCaseToWord(name) to value }.toMap()
5251
}
@@ -66,14 +65,14 @@ class HtmlReportGenerator(
6665
overallStatistics: Map<String, Long>,
6766
detailedStatistics: DetailedStatistics,
6867
composablesReport: ComposablesReport,
69-
classesReport: ClassesReport
68+
classesReport: ClassesReport,
7069
) = createHTML().html {
7170
MainContent(
7271
reportSpec = reportSpec,
7372
overallStatistics = overallStatistics,
7473
detailedStatistics = detailedStatistics,
7574
composablesReport = composablesReport,
76-
classesReport = classesReport
75+
classesReport = classesReport,
7776
)
7877
}
7978
}

0 commit comments

Comments
 (0)