Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Relax FileName rule to allow a single top-level extension #1657

Closed
igorwojda opened this issue Sep 23, 2022 · 1 comment
Closed

Relax FileName rule to allow a single top-level extension #1657

igorwojda opened this issue Sep 23, 2022 · 1 comment

Comments

@igorwojda
Copy link

FileName rule

Sample:

File MutableLiveDataExt.kt

package com.igorwojda.showcase.base.presentation.ext

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData

@Suppress("detekt.UnsafeCast")
fun <T> MutableLiveData<T>.asLiveData() = this as LiveData<T>

Expected Behavior

Ignore this rule for files containing a single tope-level extension

Current Behavior

/Users/igorwojda/StudioProjects/android-showcase/feature_base/src/main/kotlin/com/igorwojda/showcase/base/presentation/ext/MutableLiveDataExt.kt:1:1: File 'MutableLiveDataExt.kt' contains a single top level declaration and should be named 'AsLiveData.kt' [Filename]

Additional information

4.61.0

@paul-dingemans
Copy link
Collaborator

This was already fixed in ktlint 0.47.0.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants