Replace 'with' with 'context'
Reports with function calls whose receiver is used only as a context argument inside the lambda.
When the receiver passed to with is never accessed as an implicit receiver (for example, via member calls or this) but only propagated as a context argument to functions declaring context parameters, the with call can be replaced with a context call. This makes the intent explicit and better reflects how the value is actually consumed.
The quick-fix replaces the with callee with context.
Example:
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
ReplaceWithCallWithContextCall- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
This inspection requires the ContextParameters language feature to be enabled.
Inspection ID: ReplaceWithCallWithContextCall
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |