Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 1b5964f

Browse files
Apply suggestions from code review
Co-authored-by: Jeff Matthews <matthews.jeffery@gmail.com>
1 parent 95be4d5 commit 1b5964f

File tree

8 files changed

+42
-40
lines changed

8 files changed

+42
-40
lines changed

src/_data/toc/contributor-guide.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pages:
1818
url: /contributor-guide/pull-request-tests.html
1919
versionless: true
2020

21-
- label: Adding Code Inspections with PHPStorm plugin
21+
- label: PHPStorm plugin code inspections
2222
url: /contributor-guide/phpstorm-code-inspections.html
2323
versionless: true
2424

src/_data/toc/extension-best-practices.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pages:
4242
- label: Code inspection
4343
url: /ext-best-practices/phpstorm/code-inspection.html
4444

45-
- label: New Features
45+
- label: New features
4646
url: /ext-best-practices/phpstorm/extra.html
4747

4848
- label: Issue reporting
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
22
group: contributor-guide
3-
title: Adding Code Inspections with PHPStorm plugin
4-
redirect_from:
5-
- contributor-guide/phpstorm-code-inspections.html
3+
title: PHPStorm plugin code inspections
64
---
75

8-
The PHPStorm plugin is a tool created by the community to optimize routine coding operations and improve the {{site.data.var.ee}} development experience. The plugin is compatible with IntelliJ IDEA Ultimate and PhpStorm IDE. The functionality includes {{site.data.var.ee}} specific code generation shortcuts, code inspections, autocomplete functionality for configuration files, MFTF tests, and Requirejs.
6+
The PHPStorm plugin is a tool created by the community to optimize routine coding operations and improve the {{site.data.var.ee}} development experience. The plugin is compatible with the IntelliJ IDEA Ultimate and PhpStorm IDEs. The functionality includes {{site.data.var.ee}} specific code generation shortcuts, code inspections, autocomplete functionality for configuration files, MFTF tests, and RequireJS.
97

108
See the [Code generation]({{site.baseurl}}/guides/v2.3/ext-best-practices/phpstorm/code-generation.html) topic for more information.
119

12-
The PHPStorm plugin includes shortcuts for Functional Testing, Require JS mapping, GraphQL, Plugin declaration inspection, code generation, and many more.
10+
The PHPStorm plugin includes shortcuts for functional testing, RequireJS mapping, GraphQL, plugin declaration inspection, code generation, and much more.
1311

1412
See the [Adding Code Inspections]({{site.baseurl}}/guides/v2.3/ext-best-practices/phpstorm/inspections.html) topic for more information on static code analysis.

src/guides/v2.3/ext-best-practices/phpstorm/code-generation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ functional_areas:
55
- Standards
66
---
77

8-
The PHPStorm plugin enables features and functionality to assist developers in creating custom extensions.
8+
The PHPStorm plugin enables features and functionality to help you create custom extensions.
99

1010
### XML file header
1111

1212
The new include code template was added to the generated with the plugin XML files.
13-
To configure it go to the `Preferences -> Editor -> File and Code Templates -> Includes -> XML File Header`:
13+
To configure it, go to the `Preferences -> Editor -> File and Code Templates -> Includes -> XML File Header`:
1414

1515
![]({{site.baseurl}}/common/images/phpstorm/xml-file-header.png)
1616

1717
#### Usage
1818

19-
Any generated XML file will have this header, as for example:
19+
All generated XML files include the header, for example:
2020

2121
![]({{site.baseurl}}/common/images/phpstorm/xml-file-header-in-file.png)
2222

src/guides/v2.3/ext-best-practices/phpstorm/extra.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
group: extension-best-practices
3-
title: New Features
3+
title: New features
44
functional_areas:
55
- Standards
66
---
77

8-
Best practices for several issues within the PHPStorm plugin.
8+
The following sections describe best practices for using the PHPStorm plugin.
99

1010
### JS and CSS support for Copy Magento Path action
1111

src/guides/v2.3/ext-best-practices/phpstorm/inspections.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
---
22
group: extension-best-practices
3-
title: Adding Code Inspections
3+
title: Adding code inspections
44
functional_areas:
55
- Standards
66
---
77

8-
The IntelliJ Platform provides tools designed for static code analysis called code inspections, which help the user maintain and clean up code without actually executing it.
8+
The IntelliJ Platform provides tools designed for static code analysis called code inspections, which help you maintain and clean up code without actually executing it.
99
Read more in the [official documentation](https://plugins.jetbrains.com/docs/intellij/code-inspections.html).
1010

11-
The plugin inspections could be found in the `Settings | Preferences... | Editor | Inspections`.
11+
you can find plugin inspections in `Settings | Preferences... | Editor | Inspections`.
1212
Use a filter to find only the plugin inspections: `Magento 2`.
1313

1414
![Image of the Magento 2 Group Inspections]({{site.baseurl}}/common/images/phpstorm/Intellij-idea-plugin-editor-local-inspections.png)
1515

1616
See [Inspections topic](https://jetbrains.design/intellij/text/inspections/) in the IntelliJ Platform UI Guidelines
17-
on naming, writing description, and message texts for inspections to avoid basic naming conventions issues before code review.
17+
for naming, writing descriptions, and messages for inspections to avoid basic naming convention issues before code review.
1818

1919
### To add a new inspection
20+
Adding a new code inspection includes:
2021

2122
1. Declaring an inspection in the plugin configuration file
2223
1. Implementing a local inspection class to inspect code in the IntelliJ Platform-based IDE editor
@@ -28,7 +29,7 @@ on naming, writing description, and message texts for inspections to avoid basic
2829

2930
### Declaring an inspection in the plugin configuration file
3031

31-
All plugin inspections declared in the `<extensions defaultExtensionNs="com.intellij">` XML node of the plugin configuration file.
32+
You must declare all plugin inspections in the `<extensions defaultExtensionNs="com.intellij">` XML node of the plugin configuration file.
3233

3334
For example, we will implement a local inspection tool for checking preference XML tag attributes (`di.xml` file)
3435
if they are valid classes FQNs.
@@ -113,9 +114,9 @@ All visitors should extend `com.intellij.psi.PsiElementVisitor`.
113114
| `JSON` | `com.intellij.json.psi.JsonElementVisitor` |
114115
| `JavaScript` | `com.intellij.psi.PsiElementVisitor` |
115116

116-
Let's implement new `XmlElementVisitor` that overrides `visitXmlTag` method. That visitor will check all xml tags
117-
in the all xml files. We should dedicate it to check only expected xml files (`di.xml`) and expected xml tags (`<type/>`).
118-
That could be easily be done with the next part of code:
117+
Let's implement new `XmlElementVisitor` that overrides `visitXmlTag` method. That visitor will check all XML tags
118+
in all XML files. We should dedicate it to check only expected XML files (`di.xml`) and expected XML tags (`<type/>`).
119+
Use the following code to check only expected XML files:
119120

120121
```java
121122
final PsiFile file = xmlTag.getContainingFile();
@@ -126,24 +127,24 @@ if (!file.getName().equals(ModuleDiXml.FILE_NAME)
126127
}
127128
```
128129

129-
Now we can access `<type/>` tag's `name` attribute to check its value:
130+
Now we can access the `<type/>` tag's `name` attribute to check its value:
130131

131132
```java
132133
final XmlAttribute nameAttribute = xmlTag.getAttribute(ModuleDiXml.NAME_ATTR);
133134
```
134135

135136
The `XmlTag.getAttribute()` method returns `@Nullable` value. We should check if our attribute is accessible for working with it.
136-
Also, later we will need to use `XmlTag.getValueElement()` method to register problem by `ProblemsHolder` if it occurs.
137-
The `XmlTag.getValueElement()` method also returns `@Nullable` value. Let's use this code to skip visiting not correct XML attributes:
137+
Also, later we will need to use the `XmlTag.getValueElement()` method to register problems using `ProblemsHolder` if they occur.
138+
The `XmlTag.getValueElement()` method also returns `@Nullable` value. Let's use this code to skip checking incorrect XML attributes:
138139

139140
```java
140141
if (nameAttribute == null || nameAttribute.getValue() == null || nameAttribute.getValueElement() == null) {
141142
return;
142143
}
143144
```
144145

145-
Now we can access attributes values. We can check if attribute value is existing class by using [PhpClassExistenceValidator] type instance.
146-
To report problem on the `name` attribute value you can use the next code snippet:
146+
Now we can access attribute values. We can check if an attribute value is an existing class by using the [PhpClassExistenceValidator] type instance.
147+
To report problem with the `name` attribute value, you can use the following code:
147148

148149
```java
149150
problemsHolder.registerProblem(
@@ -156,24 +157,27 @@ problemsHolder.registerProblem(
156157
);
157158
```
158159

159-
You cannot access tag value of PsiElement type.
160-
So you can just report problem for tag element, as it is done by Intellij Idea inspections, for example: `com.intellij.xml.util.CheckEmptyTagInspection`.
160+
You cannot access the tag value of the `PsiElement` type.
161+
You should report problems with the tag element similar to Intellij Idea inspections. For example: `com.intellij.xml.util.CheckEmptyTagInspection`.
161162

162163
So, there is a full example: [InvalidDependencyInjectionTypeInspection]
163164

164-
### Writing an HTML description of the inspection for display in the inspection preferences panel
165+
### Writing HTML descriptions
165166

166-
You must describe all inspections in the description file. To do this you can add a new HTML file by the next path:
167+
This section shows you how to display an HTML description of the inspection in the inspection preferences panel.
168+
169+
170+
You must describe all inspections in the description file. To do this, you can add a new HTML file to the following path:
167171
`./resources/inspectionDescriptions/{shortName}.html`, where `{shortName}` is a `shortName` attribute value in the
168-
local inspection declaration. Or you can just use Intellij Idea automation for this (preferred way ).
169-
All inspection implementation classes have highlighted class name if they don't have description file and quick fix to create it:
172+
local inspection declaration. Or you can just use Intellij Idea automation to do this (preferred).
173+
All inspection implementation classes have highlighted class names if they don't have description files. Here's a quick fix to create it:
170174
![Create Inspection Description File Quick Fix]({{site.baseurl}}/common/images/phpstorm/Intellij-idea-plugin-create-inspection-description-quick-fix.png)
171175

172176
Use [Inspections topic](https://jetbrains.design/intellij/text/inspections/) to write better descriptions for inspections using naming conventions.
173177

174178
### Create a unit test for the inspection
175179

176-
You must deliver each inspection with the unit test for it. The root folder for all inspections unit tests is a `./tests/com/magento/idea/magento2plugin/inspections`. As base classes for your tests you should use predefined implementations based on languages.
180+
You must deliver each inspection with the unit test for it. The root folder for all inspections unit tests is `./tests/com/magento/idea/magento2plugin/inspections`. As base classes for your tests you should use predefined implementations based on languages.
177181

178182
**Base classes implementations for different languages:**
179183

@@ -183,8 +187,8 @@ You must deliver each inspection with the unit test for it. The root folder for
183187
| `xml` | `com.magento.idea.magento2plugin.inspections.xml.InspectionXmlFixtureTestCase` |
184188
| `graphql` | `com.magento.idea.magento2plugin.inspections.graphqls.InspectionGraphqlsFixtureTestCase` |
185189

186-
If you cover new language area, please extend `com.magento.idea.magento2plugin.inspections.BaseInspectionsTestCase` class and add new abstract class for that area.
187-
All test classes names should have a suffix Test and all testing methods should have a prefix test and detailed description in the annotation.
190+
If you cover new language area, please extend the `com.magento.idea.magento2plugin.inspections.BaseInspectionsTestCase` class and add a new abstract class for that area.
191+
All test class names should have the suffix "test" and all testing methods should have the prefix "test" and detailed description in the annotation.
188192
Also, you should enable testing inspection in the `setUp()` method.
189193

190194
```java

src/guides/v2.3/ext-best-practices/phpstorm/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
group: extension-best-practices
3-
title: PHPStorm Plugin
3+
title: PHPStorm plugin
44
functional_areas:
55
- Standards
66
---
77

8-
The PHPStorm plugin is a tool created by the community to optimize routine coding operations and improve the {{site.data.var.ee}} development experience. The plugin is compatible with IntelliJ IDEA Ultimate and PhpStorm IDE. The functionality includes {{site.data.var.ee}} specific code generation shortcuts, code inspections, autocomplete functionality for configuration files, MFTF tests, and Requirejs.
8+
The PHPStorm plugin is a tool created by the community to optimize routine coding operations and improve the {{site.data.var.ee}} development experience. The plugin is compatible with the IntelliJ IDEA Ultimate and PhpStorm IDEs. The functionality includes {{site.data.var.ee}} specific code generation shortcuts, code inspections, autocomplete functionality for configuration files, MFTF tests, and RequireJS.
99

1010
See the [Code generation]({{site.baseurl}}/guides/v2.3/ext-best-practices/phpstorm/code-generation.html) topic for more information.
1111

src/guides/v2.3/ext-best-practices/phpstorm/uct-run-configuration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ Run Configurations are used to run internal and external processes from within I
1111

1212
See the [Run/Debug configurations topic](https://www.jetbrains.com/help/idea/run-debug-configuration.html) in the IntelliJ IDEA to understand the concept of a run configuration.
1313

14-
The Run Configuration is a Graphical User Interface (GUI) for the {{site.data.var.uct}}. This allows the {{site.data.var.uct}} instance to be configured via composer. It is recommended that the {{site.data.var.uct}} is installed in the current project. However, if the {{site.data.var.uct}} is located outside the current project, a message is shown alerting of the possibility to download and install {{site.data.var.uct}} in the current project.
14+
The Run Configuration is a Graphical User Interface (GUI) for the {{site.data.var.uct}}. This allows the {{site.data.var.uct}} instance to be configured using Composer. We recommend that you install the {{site.data.var.uct}} in the current project. However, if the {{site.data.var.uct}} is located outside the current project, a message displays providing an optoin to download and install it in the current project.
1515

1616
{:.bs-callout-warning}
17-
The {{site.data.var.uct}} is an {{site.data.var.ee}} feature. You will need your {{site.data.var.ee}} license key to install it.
17+
The {{site.data.var.uct}} is an {{site.data.var.ee}} feature. You need your {{site.data.var.ee}} license key to install it.
1818

1919
![]({{site.baseurl}}/common/images/phpstorm/uct-run-configuration-1-min.gif)
2020

21-
When you create a new run configuration for a specific tool, create it from one of the dedicated configuration templates, which implement the startup logic, defines the list of parameters and their default values.
21+
When you create a new run configuration for a specific tool, create it from one of the dedicated configuration templates. Templates implement the startup logic and define the list of parameters and their default values.
2222

2323
The {{site.data.var.uct}} Run Configuration template is located in the PHPStorm plugin menu, under **Run/Debug configurations** > **Add New Configuration** > **Upgrade Compatibility Tool**.
2424

@@ -39,7 +39,7 @@ These are the main components of the {{site.data.var.uct}} Run Configuration tem
3939

4040
See [Run]({{site.baseurl}}/upgrade-compatibility-tool/run.html) topic for more information on these specific options of the {{site.data.var.uct}}.
4141

42-
Once the template is configured correctly, you can run the {{site.data.var.uct}} via a single click in your Run Configuration GUI.
42+
After you correctly configure the template, you can run the {{site.data.var.uct}} with a single click in your Run Configuration GUI.
4343

4444
## Run the tool
4545

0 commit comments

Comments
 (0)