-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I use Kotest, a powerful unit testing framework that has many different test spec styles. One of them is based on Jest using functions called describe and it. Because all test specs are written in a lambda, calling the latter function can cause false positives because Diktat confuses it for a parameter called it, even though the lambda has no parameters.
Expected behavior
Diktat should ignore the use of the it function, since it's not a parameter of the lambda. This is provable by the fact that the lambda has no parameters.
Observed behavior
Diktat reports both TOO_MANY_LINES_IN_LAMBDA and PARAMETER_NAME_IN_OUTER_LAMBDA violations.
Steps to Reproduce
- Write a class that includes a function called
itand another function that takes in a zero-parameter lambda as an argument. - Call the latter function from someplace, and inside the lambda that is passed, call the
itfunction. - Inside the same lambda, call another function that uses a lambda (e.g.
let,also,with...). - Run Diktat. It will complain about the outer lambda's parameter being called
it, even though said parameter does not exist.
Environment information
- diktat version: 2.0.0
- build tool (maven/gradle): Gradle
- how is diktat run (CLI, plugin, etc.): Spotless
- kotlin version: 2.2.10
- operating system: Windows 11
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working