Skip to content

Commit 32146b0

Browse files
author
Prabha Kylasamiyer Sundara Rajan
committed
Fixed the rule indentation and added location descriptions
Signed-off-by: Prabha Kylasamiyer Sundara Rajan <[email protected]>
1 parent c8abe98 commit 32146b0

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

docs/topics/rules-development/create-go-custom-rule.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
[role="_abstract"]
1010
You can create custom rules for Golang (Go) applications based on the following example.
1111

12-
You can use the following custom rule to check if MTA triggers an incident when it detects a go file in your project.
12+
You can use the following custom rule to check if {ProductShortName} triggers an incident when it detects a `go` file in your project.
1313

1414
.Procedure
15-
. Create a `go-rule-001.yml` file in a directory. .
15+
. Create a `go-rule-001.yml` file in a directory.
1616

1717
. Copy the following rule in the `yaml` file:
1818
+
@@ -54,16 +54,16 @@ func main() {
5454

5555
[source, terminal]
5656
----
57-
$ ./mta-cli analyze -i <path_to_Go_project> -o <path_to_report_directory> \ --run-local=false --rules <path_to_go-rule-001.yml>
57+
$ ./mta-cli analyze -i _<path_to_Go_project>_ -o _<path_to_report_directory>_ \ --run-local=false --rules _<path_to_go-rule-001.yml>_
5858
----
5959
+
6060
6161
[NOTE]
6262
====
63-
Add the --overwrite option if you want to use the same directory for the report when you run subsequent tests. {ProductShortName} overwrites the current report with the result of the latest analysis that you run.
63+
Add the `--overwrite` option if you want to use the same directory for the report when you run subsequent tests. {ProductShortName} overwrites the current report with the result of the latest analysis that you run.
6464
====
6565

66-
. Open the static report in the path `/home/<USER>/output/static-report/` in your browser.
66+
. Open the static report at `/home/<USER>/output/static-report/` in your browser.
6767

6868
. Navigate to the issues to verify the `golang apiextensions/v1/customresourcedefinitions found {{file}}:{{lineNumber}}` issue.
6969

docs/topics/rules-development/create-nodejs-custom-rule.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
= Creating a custom Node.js rule
88

99
[role="_abstract"]
10-
{ProductShortName} requires you to create custom rules to analyze `Node.js` applications. A `Node.js` rule can contain `nodejs.referenced` capability which supports the `pattern` field.
10+
You must create custom rules to analyze `Node.js` applications by using {ProductShortName}. A `Node.js` rule can contain `nodejs.referenced` capability which supports the `pattern` field.
1111

1212
The following example uses a custom rule to check if a `.tsx` file in the `Node.js` project imports the `React` framework.
1313

1414
.Procedure
15-
. Create the directory `test-nodejs`.
15+
. Create the `test-nodejs` directory.
1616
+
1717

1818
[source, terminal]
@@ -25,7 +25,7 @@ $ mkdir -p ~/test-nodejs
2525
[source, yaml]
2626
----
2727
- ruleID: test-tsx-support-00000
28-
description: "Found React import in .tsx file"
28+
description: Found React import in .tsx file
2929
message: Found React import in .tsx file
3030
effort: 1
3131
when:
@@ -55,12 +55,12 @@ $ ./mta-cli analyze -i ~/test-nodejs/ -o \
5555

5656
[NOTE]
5757
====
58-
Add the --overwrite option if you want to use the same directory for the report when you run subsequent tests. {ProductShortName} overwrites the current report with the result of the latest analysis that you run.
58+
Add the `--overwrite` option if you want to use the same directory for the report when you run subsequent tests. {ProductShortName} overwrites the current report with the result of the latest analysis that you run.
5959
====
6060

6161
. Open the static report at `~/test-nodejs/report/static-report/index.html` in your browser.
6262

63-
. Click the <application_name> to open the Dashboard.
63+
. Click the _<application_name>_ to open the Dashboard.
6464

6565
. Review the incidents in the *Issues* tab.
6666

docs/topics/rules-development/create-python-custom-rule.adoc

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
= Creating custom Python rules
88

99
[role="_abstract"]
10-
{ProductShortName} requires you to create custom rules to analyze `Python` applications. A `Python` rule can contain `python.referenced` capability with the supported fields.
10+
You must create custom rules to analyze `Python` applications by using {ProductShortName}. A `Python` rule can contain `python.referenced` capability with the supported fields.
1111

12-
The following example uses two custom rules: the first rule checks if `bad_method` is specified and the second rule checks if `hello_world` is specified in `file_a.py` in your project.
12+
The following example uses two custom rules:
13+
14+
* The first rule checks if `bad_method` is specified
15+
* The second rule checks if `hello_world` is specified in `file_a.py` in your project.
1316
1417
.Procedure
1518
. Create the directory `test-python`.
1619
+
17-
1820
[source, terminal]
1921
----
2022
$ mkdir -p ~/test-python
@@ -35,16 +37,15 @@ $ mkdir -p ~/test-python
3537
3638
. Create a `python-rule-002.yml` file in the directory and add the following rule:
3739
+
38-
3940
[source, yaml]
4041
----
41-
- category: mandatory
42-
ruleID: python-rule-002
43-
effort: 1
44-
message: "Found a python"
45-
when:
46-
python.referenced:
47-
pattern: "hello_world"
42+
- category: mandatory
43+
ruleID: python-rule-002
44+
effort: 1
45+
message: "Found a python"
46+
when:
47+
python.referenced:
48+
pattern: "hello_world"
4849
----
4950
5051
. Save the following `Python` code as `file_b.py`.
@@ -62,7 +63,6 @@ def bad_method():
6263
6364
. Save the following code as a second file, `file_a.py`.
6465
+
65-
6666
[source, python]
6767
----
6868
import file_b
@@ -72,7 +72,6 @@ print(file_b.bad_method())
7272
7373
. Run the following command in the {ProductShortName} CLI:
7474
+
75-
7675
[source, terminal]
7776
----
7877
$ ./mta-cli analyze -i ~/test-python/ -o \
@@ -84,12 +83,12 @@ $ ./mta-cli analyze -i ~/test-python/ -o \
8483
8584
[NOTE]
8685
====
87-
Add the --overwrite option if you want to use the same directory for the report when you run subsequent tests. {ProductShortName} overwrites the current report with the result of the latest analysis that you run.
86+
Add the `--overwrite` option if you want to use the same directory for the report when you run subsequent tests. {ProductShortName} overwrites the current report with the result of the latest analysis that you run.
8887
====
8988
9089
. Open the static report at `~/test-python/report/static-report/index.html` in your browser.
9190
92-
. Click the <application_name> to open the Dashboard.
91+
. Click the _<application_name>_ to open the Dashboard.
9392
9493
. Review the incidents in the *Issues* tab.
9594

docs/topics/rules-development/yaml-java-locations.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ when:
167167
location: METHOD
168168
pattern: '* java.lang.String'
169169
----
170-
|METHOD_CALL|Matches against method calls in the source code.
171-
a|
170+
|METHOD_CALL|Matches against the method call in the source code.
171+
a|The following example matches the `getConnection` method call of the `java.sql.DriverManager` class with three parameters of type `String`.
172172
[source, yaml]
173173
----
174174
when:
@@ -187,7 +187,7 @@ when:
187187
pattern: javax.xml*
188188
----
189189
|CONSTRUCTOR_CALL|Matches against constructor calls in the source code.
190-
a|The following example
190+
a|The following example matches the `FileOutputStream` constructor call that takes a String and a boolean value as input parameters.
191191
[source, yaml]
192192
----
193193
when:
@@ -196,7 +196,7 @@ when:
196196
pattern: java.io.FileOutputStream(java.lang.String, boolean)
197197
----
198198
|IMPORT|Matches against class imports. You can use it with FQNs or an asterisk (*) to allow for wider matches.
199-
a|
199+
a|The following example matches with the import of `org.apache.lucene.search` package and sub packages in the source code.
200200
[source, yaml]
201201
----
202202
when:

0 commit comments

Comments
 (0)