Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Weird unexpected indentation exception #1319

Closed
nuhkoca opened this issue Dec 20, 2021 · 1 comment
Closed

Weird unexpected indentation exception #1319

nuhkoca opened this issue Dec 20, 2021 · 1 comment
Labels
Milestone

Comments

@nuhkoca
Copy link

nuhkoca commented Dec 20, 2021

I am getting a weird exception even though my code is well formatted. Please feel free to close if any open PR intends to fix a similar issue.

Expected Behavior

Ktlint won't fail

Observed Behavior

Ktlint will fail

Steps to Reproduce

  1. Have the things below
fun myFunc(myClass: MyClass) = with(myClass) {
    myVar = MyClass(
        image = "",
        timestamp = "",
        location = "",
        videoUrl = ""
    )
}
class MyFragment : Fragment(R.layout.myFragment) {

    private var _binding: MyFragmentBinding? = null
    private val binding get() = _binding!!

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        _binding = MyFragmentBinding.bind(view)

        binding.myTextView.text = getString(
            R.string.myString,
            myArg
        )
    }
}
  1. Execute ./gradlew ktlintFormat
  2. See the exception in terminal

Unexpected indentation (expected 8, actual 12)

Your Environment

  • Version of ktlint used: 0.44.0-SNAPSHOT
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): Ktlint plugin 10.2.0
  • Version of Gradle used (if applicable): 7.1.1
  • Operating System and version: MacOS
@paul-dingemans
Copy link
Collaborator

Closed by #1284

@paul-dingemans paul-dingemans added this to the 0.44.0 milestone Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants