Unable to suppress a rule with spotless i've added...
# ktlint
n
Unable to suppress a rule with spotless i've added https://mrmans0n.github.io/compose-rules/rules/#hoist-all-the-things custom ruleset to ktlint spotless but i'm unable to suppress a rule for a function I tried adding @Suppress("ktlintjetpack composevm-forwarding-check") above the function but it doesn't work FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':spotlessKotlin'. Error on line: 127, column: 17 rule: compose:vm-forwarding-check Forwarding a ViewModel/Presenter through multiple https://github.com/composable functions should be avoided. Consider using state hoisting. See https://mrmans0n.github.io/compose-rules/rules/#hoist-all-the-things for more information. Try: Run with --info or --debug option to get more log output.
p
Please use the rule set id in the suppression, like:
Copy code
@Suppress("ktlint:compose:vm-forwarding-check")
n
i'm using exactly same, even then its giving me same error
Copy code
@Suppress("ktlint:compose:vm-forwarding-check")
c
where did you put the annotation? Don’t put in on the “composable” but the VM parameter. This “suppress” works on the Composable for me. There are others that need to be suppressed on the parameter.
n
Copy code
fun mycomposable(
	viewModel: MyViewModel
){
    // some code
}

@Composable
fun MainComposable(	viewModel: MyViewModel
){
    
    mycomposable(viewmodel)
}
where should i add the suppress. added it above my composable and MainComposable both didn't work
c
this works on my side
Copy code
@Composable
@Suppress("ktlint:compose:vm-forwarding-check")
fun ServerSetup(
    server: Server?,
    onCancel: (() -> Unit)?,
    onDone: () -> Unit,
    modifier: Modifier = Modifier,
    viewModel: ServerSetupViewModel,
)
n
I’m using the same on my side but it is still giving error on the same line
@Paul Dingemans any suggestions here^
p
Which ktlint version is used by Spotless? Can you reproduce the problem when using Ktlint CLI?