在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):JetBrains/inspection-plugin开源软件地址(OpenSource Url):https://github.com/JetBrains/inspection-plugin开源编程语言(OpenSource Language):Kotlin 97.7%开源软件介绍(OpenSource Introduction):IDEA inspection pluginThis plugin is intended to run IDEA inspections during Gradle build. Current status: beta version 0.3.3 is available till 30 April 2021. IMPORTANT: deprecation announcementAfter EAP start for Qodana and the planned sunset of Bintray, we decided not to support inspection plugin anymore. Beginning from 1 May 2021, inspection plugin will not be more accessible at bintray and therefore will be unusable from this date. At this point we recommend migration to Qodana, as this tool has much better support and architectural stability. This GitHub project will be archived soon. Examples
Usage
This adds one inspection plugin task per source root, normally its name is Also you should specify IDEA version to use and (optionally) kotlin plugin version to use, e.g. inspections {
idea.version "ideaIC:2019.1.4"
plugins.kotlin.version "1.3.72"
} In this example inspections will be taken from IDEA CE version 2019.1.4.
Plugin works at least with IDEA CE versions 2017.1, 2017.2, 2017.2.x, 2017.3, 2017.3.x, 2018.1, 2018.1.x, 2018.2, 2018.2.x.
IDEA CE 2018.3, 2018.3.x, 2019.1, 2019.1.x are supported in plugins 0.3.0+ only.
If you have multi-platform project, it's recommended to use IDEA CE 2018.2 or later.
Kotlin plugin versions from 1.2.21 to 1.2.71 are supported directly (required version for your IDE is chosen and downloaded automatically),
otherwise you will have to specify download URL (see below, Plugins 0.2.2 and earlier support only so-called local inspections (most Kotlin inspections fall into this category). Global inspections (e.g. most Android Lint and part of Java inspections) are supported only in 0.3.0+. There are three ways to specify inspections for code analysis: Inherit from IDEAinspections {
inheritFromIdea = true
} In this case inspection configuration will be read from file Manual inspections listinspections {
error('org.jetbrains.kotlin.idea.inspections.DataClassPrivateConstructorInspection')
error('org.jetbrains.kotlin.idea.inspections.UseExpressionBodyInspection')
warning('org.jetbrains.kotlin.idea.inspections.RedundantVisibilityModifierInspection')
warning('org.jetbrains.kotlin.idea.inspections.AddVarianceModifierInspection')
info('org.jetbrains.java.generate.inspection.ClassHasNoToStringMethodInspection')
} In this case inspections from manually defined list will be in use. Plugins 0.3.0+ allows shorter format (class name only without Inspection suffix): inspections {
error('DataClassPrivateConstructor')
error('UseExpressionBody')
warning('RedundantVisibilityModifier')
warning('AddVarianceModifier')
info('ClassHasNoToStringMethod')
} or this way (via displayable inspection names): inspections {
error("Private data class constructor is exposed via the 'copy' method")
error("Expression body syntax is preferable here")
warning("Redundant visibility modifier")
warning("Type parameter can have 'in' or 'out' variance")
info("Class does not override 'toString()' method")
} Mixing definitioninspections {
inheritFromIdea = true
error('org.jetbrains.kotlin.idea.inspections.DataClassPrivateConstructorInspection')
error('org.jetbrains.kotlin.idea.inspections.UseExpressionBodyInspection')
warning('org.jetbrains.kotlin.idea.inspections.RedundantVisibilityModifierInspection')
warning('org.jetbrains.kotlin.idea.inspections.AddVarianceModifierInspection')
info('org.jetbrains.java.generate.inspection.ClassHasNoToStringMethodInspection')
} In this case both inspections from manually defined list and inherited from IDEA will be in use. To run inspections, execute from terminal: Auto-formattingAuto formatting of a source code is an experimental feature. To run auto-formatting, execute from terminal: JDK configurationTo run inspections correctly, inspection plugin configures JDK in IDEA used. To do it, values of different environment variables are read:
Path to JDK which is used on your project must be available among these variables. Additional optionsYou can specify additional options in inspections {
errors.max = 5
warnings.max = 20
info.max = 10
ignoreFailures = true
quiet = true
warning('org.jetbrains.java.generate.inspection.ClassHasNoToStringMethodInspection') {
quickFix = true
}
reformat.quickFix = true
plugins.kotlin.version = '1.2.60'
plugins.kotlin.location = 'https://plugins.jetbrains.com/plugin/download?rel=true&updateId=48409'
tempDirInHome = true
} The meaning of the parameters is the following:
If you wish to change location of report file, you should specify it in closure for particular task, e.g. inspectionsMain {
reports {
xml {
destination file("reportFileName")
}
html {
destination file("reportFileName")
}
}
} Bugs and ProblemsYou can report issues on the relevant tab: https://github.com/JetBrains/inspection-plugin/issues It's quite probable that plugin does not work yet in some environment. It may result in various exceptions during IDEA configuration process. If you found such a case, please execute:
and attach Known bugs / problems at this moment (version 0.3.3):
Build and TestTest code is in Must do tasks before
NB: for me performing just top-level |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论