Skip to content

Commit

Permalink
Merge pull request #547 from hannesa2/ktlint-12.1.0
Browse files Browse the repository at this point in the history
ktlint 12.1.0
  • Loading branch information
hannesa2 authored Jan 10, 2024
2 parents 7c83034 + efa4309 commit 25bf798
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 37 deletions.
41 changes: 39 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
[*]
max_line_length = 150

[*.{kt, kts}]
ktlint_disabled_rules=argument-list-wrapping,wrapping,multiline-if-else,no-consecutive-blank-lines,no-wildcard-imports,import-ordering,max-line-length,import-ordering,no-blank-line-before-rbrace,final-newline,indent,no-multi-spaces,comment-spacing,parameter-list-wrapping
ktlint_standard = enabled # Disable all rules from the `standard` rule set provided by KtLint
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_chain-method-continuation = disabled
ktlint_standard_no-blank-line-before-rbrace = disabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_function-expression-body = disabled
ktlint_standard_no-consecutive-blank-lines = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_wrapping = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-ktlint_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_trailing-trailing-comma-on-call-site = disabled
ktlint_standard_final-newline = enabled
ktlint_standard_comment-spacing = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_indent = disabled
ktlint_standard_if-else-bracing = disabled
ktlint_standard_if-else-wrapping = disabled
ktlint_standard_import-ordering = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_discouraged-comment-location = disabled
ktlint_standard_enum-wrapping = disabled
ktlint_standard_annotation = disabled
ktlint_standard_no-consecutive-comments = disabled
ktlint_standard_block-comment-initial-star-alignment = disabled
ktlint_standard_parameter-list-spacing = disabled
ktlint_standard_comment-wrapping = disabled
ktlint_experimental = enabled # Enable rules marked as experimental for all rule sets that are enabled
ktlint_standard_some-experimental-rule = disabled # Disables the (experimental) `some-experimental-rule` in the `standard` rule set provided by KtLint
ktlint_custom-rule-set = enabled # Enable all rules in the `custom-rule-set` rule set (not provided by KtLint)
ktlint_custom-rule-set_custom-rule = disabled # Disables the `custom-rule` rule in the `custom-rule-set` rule set (not provided by KtLint)

11 changes: 0 additions & 11 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
with:
distribution: 'adopt'
java-version: 17
- uses: gradle/wrapper-validation-action@v1
- name: Install Android SDK
uses: hannesa2/action-android/[email protected]
- name: Run tests
Expand Down Expand Up @@ -83,4 +84,6 @@ jobs:
if: ${{ always() }}
with:
name: MQTT-Lint-report
path: ./**/build/reports/lint-results*.html
path: |
./**/build/reports/lint-results*.html
./**/build/reports/ktlint/ktlintMainSourceSetCheck/ktlintMainSourceSetCheck.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ class MQTTExampleActivity : AppCompatActivity() {
private const val publishMessage = "Hello World"
private var clientId = "BasicSample"
}
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:8.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.6.1"
classpath "org.jlleitschuh.gradle:ktlint-gradle:12.1.0"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import org.junit.rules.TestName
import org.junit.runner.RunWith
import timber.log.Timber


@RunWith(AndroidJUnit4::class)
class ExtendedPublishTest {

Expand Down Expand Up @@ -56,7 +55,7 @@ class ExtendedPublishTest {

onView(withId(R.id.disConnectSwitch)).perform(click())
onView(withId(3)).perform(click())
//onView(withTagValue(`is`("Subscribe" as Any))).perform(click())
// onView(withTagValue(`is`("Subscribe" as Any))).perform(click())

onView(withId(R.id.subscribe_button)).perform(click())
onView(withId(R.id.subscription_topic_edit_text)).perform(typeText(TOPIC))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ class StrictApplication : LoggingApplication() {
.build()
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class HomeFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_home, container, false)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ class PublishFragment : Fragment() {
companion object {
var DEFAULT_TOPIC = "/test"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ class SubscriptionFragment : Fragment() {
alert.window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
alert.show()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,4 @@ class AndroidServiceTest : IMqttActionListener {
private val classSimpleName = this::class.java.simpleName
private val TAG = classSimpleName
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,4 @@ class AndroidServiceWithActionListenerTest {
private val classCanonicalName = this::class.java.canonicalName
private val TAG = classCanonicalName
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ class MqttReceiver(mqttClient: IMqttAsyncClient) : MqttCallback {

data class ReceivedMessage(var topic: String, var message: MqttMessage)
data class ValidateResult(val ok: Boolean, var message: String)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ internal class TestProperties(private val context: Context) {
private val KEY_SERVER_SSL_URI = "SERVER_SSL_URI"
private val KEY_WAIT_FOR_COMPLETION_TIME = "WAIT_FOR_COMPLETION_TIME"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ enum class Ack {
* to [MqttAndroidClient] using [MqttAndroidClient.acknowledgeMessage]
*/
MANUAL_ACK
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ internal class MqttConnectTokenAndroid(private val sessionPresent: Boolean) : IM
override fun getResponse(): MqttWireMessage? {
return null
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal interface MqttServiceConstants {
const val MESSAGE_ID = "messageId"
const val SESSION_PRESENT = "sessionPresent"

/* Tags for actions passed between the Activity and the Service */
// Tags for actions passed between the Activity and the Service
const val SEND_ACTION = "send"
const val UNSUBSCRIBE_ACTION = "unsubscribe"
const val SUBSCRIBE_ACTION = "subscribe"
Expand All @@ -28,10 +28,10 @@ internal interface MqttServiceConstants {
const val ON_CONNECTION_LOST_ACTION = "onConnectionLost"
const val TRACE_ACTION = "trace"

/* Identifies an Intent which calls back to the Activity */
// Identifies an Intent which calls back to the Activity
const val CALLBACK_TO_ACTIVITY = ".callbackToActivity.$VERSION"

/* Identifiers for extra data on Intents broadcast to the Activity */
// Identifiers for extra data on Intents broadcast to the Activity
const val CALLBACK_ACTION = ".callbackAction"
const val CALLBACK_STATUS = ".callbackStatus"
const val CALLBACK_CLIENT_HANDLE = ".$CLIENT_HANDLE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ class ParcelableMqttMessage : MqttMessage, Parcelable {
return arrayOfNulls(size)
}
}
}
}
4 changes: 2 additions & 2 deletions serviceLibrary/src/main/java/info/mqtt/android/service/QoS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ enum class QoS(val value: Int) {
companion object {
@JvmStatic
fun valueOf(qos: Int): QoS {
return values()[qos]
return entries[qos]
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import android.os.Parcelable
@Suppress("DEPRECATION")
inline fun <reified T : Parcelable> Bundle.parcelable(key: String): T? = when {
SDK_INT >= 33 -> getParcelable(key, T::class.java)
else -> getParcelable(key) as? T
else -> getParcelable(key) as? T
}

@Suppress("DEPRECATION")
inline fun <reified T : Serializable> Bundle.serializable(key: String): T? = when {
SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getSerializable(key, T::class.java)
else -> getSerializable(key) as? T
}
else -> getSerializable(key) as? T
}

0 comments on commit 25bf798

Please sign in to comment.