Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
[*.kt]
indent_size = 4
indent_style = space

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma_on_call_site=true
ij_kotlin_allow_trailing_comma=true

[*]
insert_final_newline = true

ktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than = 13
ktlint_function_naming_ignore_when_annotated_with=Composable

# disabled rules after 1.5.0 upgrade
# disabled rules we should decide whether to enable or not
ktlint_standard_annotation = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_blank-line-between-when-conditions = disabled
ktlint_standard_chain-method-continuation = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_enum-wrapping = disabled
ktlint_standard_function-expression-body = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_if-else-wrapping = disabled
ktlint_standard_indent = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_statement-wrapping = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_condition-wrapping = disabled
ktlint_standard_enum-wrapping = disabled
ktlint_standard_function-expression-body = disabled
ktlint_standard_no-blank-line-in-list = disabled

ktlint_standard_property-wrapping = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_if-else-wrapping = disabled

ktlint_standard_when-entry-bracing = disabled

# rules that enforce style we don't want
ktlint_standard_backing-property-naming = disabled # it would force making backed properties public.
ktlint_standard_expression-operand-wrapping = disabled # noisy and doesn't improve readability much
ktlint_standard_max-line-length = disabled # already enabled in detekt
ktlint_standard_no-consecutive-comments = disabled # it would limit one line comments to one per line

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package mozilla.appservices.logins

/**
/*
* Import some private Glean types, so that we can use them in type declarations.
*
* I do not like importing these private classes, but I do like the nice generic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ open class Nimbus(
}
}

override fun applyLocalExperiments(@RawRes file: Int): Job =
override fun applyLocalExperiments(
@RawRes file: Int,
): Job =
applyLocalExperiments { loadRawResource(file) }

@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
Expand Down Expand Up @@ -369,7 +371,9 @@ open class Nimbus(
}
}

override fun setExperimentsLocally(@RawRes file: Int) {
override fun setExperimentsLocally(
@RawRes file: Int,
) {
dbScope.launch {
withCatchAll("setExperimentsLocally") {
loadRawResource(file)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,16 @@ interface NimbusInterface : FeaturesInterface, NimbusMessagingInterface, NimbusE
* If this is cancelled, then {initialize} is called, which copies the database in to an
* in memory cache.
*/
fun applyLocalExperiments(@RawRes file: Int): Job = Job()
fun applyLocalExperiments(
@RawRes file: Int,
): Job = Job()

/**
* A utility method to load a file from resources and pass it to `setExperimentsLocally(String)`.
*/
fun setExperimentsLocally(@RawRes file: Int) = Unit
fun setExperimentsLocally(
@RawRes file: Int,
) = Unit

/**
* Testing method to reset the enrollments and experiments database back to its initial state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,8 @@ class NimbusTests {

val calculatedAttributes = getCalculatedAttributes(
date.timeInMillis - 86400000 * 5,
db.path, deviceInfo.localeTag,
db.path,
deviceInfo.localeTag,
)

assertEquals(5, calculatedAttributes.daysSinceInstall)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,18 @@ class PlacesConnectionTest {
Pair("https://www.example.com/12345", false),
// Bad URLs should still work without.
Pair("https://www.example.com:badurl", false),

Pair("https://www.mozilla.com", true),
Pair("https://www.firefox.com", true),
Pair("https://www.mozilla.org", false),

// Dupes should still work
Pair("https://www.example.com/1234", true),
Pair("https://www.example.com/12345", false),

// The unicode URLs should work when escaped the way we
// encountered them
Pair("$unicodeInPath/1", true),
Pair("$escapedUnicodeInPath/2", true),
Pair("$unicodeInDomain/1", true),
Pair("$escapedUnicodeInDomain/2", true),

// But also the other way.
Pair("$unicodeInPath/2", true),
Pair("$escapedUnicodeInPath/1", true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ private class ErrorEventSink : EventSink {
val fields = json.decodeFromString<TracingBreadcrumbFields>(event.fields)

ApplicationErrorReporterRegistry.errorReporter?.reportBreadcrumb(
event.message, fields.module, fields.line, fields.column,
event.message,
fields.module,
fields.line,
fields.column,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

@file:Suppress(
"ClassName", "InvalidPackageDeclaration", "ktlint:standard:filename",
"ktlint:standard:property-naming", "MatchingDeclarationName",
"ClassName",
"InvalidPackageDeclaration",
"ktlint:standard:filename",
"ktlint:standard:property-naming",
"MatchingDeclarationName",
)

package com.example.app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
/*
* This is a mock implementation of Android's `Context` object to allow us to run tests of the generated
* code against the real `FeatureVariables` code.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
/*
* This is a mock implementation of Android's `Drawable` object to allow us to run tests of the generated
* code against the real `FeatureVariables` code.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ object SyncTelemetry {
@Suppress("LongParameterList")
fun processSyncTelemetry(
syncTelemetry: SyncTelemetryPing,

// The following are present to make this function testable. In tests, we need to "intercept"
// values set in singleton ping objects before they're reset by a 'submit' call.
submitGlobalPing: () -> Unit = { Pings.sync.submit() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ internal class FetchBackend(val client: Lazy<FetchClient>) : Backend {
body = fetchResp.body.useStream {
it.readBytes()
},

)
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jna = "5.18.1"

# Linting and Static Analysis
detekt = "1.23.8"
ktlint = "1.7.1"
ktlint = "1.8.0"

# AndroidX Testing
androidx-test = "1.7.0"
Expand Down