code_inspections.md: Link IntelliJ Community sources and replace "_intellij_community_" with "IntelliJ Community"

This commit is contained in:
Karol Lewandowski 2023-02-13 13:04:40 +01:00
parent 9d658eb3a9
commit 69b4b84bb1

View File

@ -1,6 +1,6 @@
# Code Inspections
<!-- Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<tldr>
@ -32,20 +32,20 @@ It illustrates the components for a custom inspection plugin:
* Writing an HTML [description](#inspection-description) of the inspection for display in the inspection preferences panel.
* Optionally, create a [unit test](#inspection-unit-test) for the plugin.
Although the IntelliJ Platform SDK code samples illustrate implementations of these components, it is often useful to see examples of inspections implemented in the _intellij_community_ code base.
Although the IntelliJ Platform SDK code samples illustrate implementations of these components, it is often useful to see examples of inspections implemented in the [IntelliJ Community](https://github.com/JetBrains/intellij-community) code base.
This process can help find inspection descriptions and implementations based on what is visible in the IDE UI.
The overall approach works for inspections aimed at other languages as well.
* Find an existing inspection that is similar to the one you want to implement in the <ui-path>Settings | Editor | Inspections</ui-path> panel.
Note the display name of the inspection.
For example, the Java/Probable Bugs inspection <control>Object comparison using '==', instead of 'equals()'</control> is very similar to `comparing_references_inspection`.
* Use the display name text as the [target for a search](https://www.jetbrains.com/help/idea/finding-and-replacing-text-in-project.html) within the _intellij_community_ project.
* Use the display name text as the [target for a search](https://www.jetbrains.com/help/idea/finding-and-replacing-text-in-project.html) within the IntelliJ Community project.
This will identify a bundle file if the display name is localized.
If it is not localized, the search finds either the <path>[plugin.xml](plugin_configuration_file.md)</path> file where it is an attribute in the inspection description, or the implementation where it is provided by an overridden method.
* In the case of localization, copy the key from the bundle file identified by the search.
* Use the key text as the target for a search within the _intellij_community_ project.
* Use the key text as the target for a search within the IntelliJ Community project.
This search locates the plugin configuration file that describes the inspection.
* From the inspection description entry, find the `implementationClass` attribute value.
* Use the `implementationClass` text as the [target of a class search](https://www.jetbrains.com/help/idea/searching-everywhere.html#Searching_Everywhere.xml) in the _intellij_community_ codebase to find the implementation.
* Use the `implementationClass` text as the [target of a class search](https://www.jetbrains.com/help/idea/searching-everywhere.html#Searching_Everywhere.xml) in the IntelliJ Community codebase to find the implementation.
See also [](explore_api.md) for more information and strategies.