Inspectopedia Help

Possibly misplaced call to Gradle method

Detects possibly misplaced calls to Gradle methods.

Gradle buildscripts comprise a lot of nested closures, making the code structure similar to a markup language. Due to the behavior of DSL languages, the methods that you can write in the outer closures are also available in the inner ones. Such methods may have no meaning when written outside their scope. Sometimes it may be hard to detect this situation. This inspection aims to detect such methods.

Example:

repositories { // the delegate of 'repositories' has method 'exclusiveContent', which can be written here maven { // the delegate of 'maven' has method 'content', which can be written here // but 'exclusiveContent' is also available exclusiveContent {} // reports 'exclusiveContent' } }

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.

ForeignDelegate
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.

Settings or Preferences | Editor | Inspections | Gradle | Probable bugs

Availability

By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Gradle-Java, 241.18072

Last modified: 18 June 2024