Skip to content

Commit 01a4c6d

Browse files
committed
feat(analyze): add command line support for static analysis of Robot Framework projects
1 parent 8872348 commit 01a4c6d

File tree

21 files changed

+551
-129
lines changed

21 files changed

+551
-129
lines changed

.vscode/launch.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@
2020
"request": "launch",
2121
"module": "robotcode.cli",
2222
"justMyCode": false,
23-
//"cwd": "${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data/tests",
23+
"cwd": "${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data",
2424
//"cwd": "${workspaceFolder}/..",
25-
"cwd": "E:/source/uvtestprj",
26-
//"cwd": "C:\\develop\\robot\\robotframework",
25+
//"cwd": "${workspaceFolder}",
26+
//"cwd": "E:/source/uvtestprj",
27+
//"cwd": "e:\\develop\\robot\\robotframework",
2728
// "env": {
2829
// "ROBOTCODE_COLOR": "1",
2930
// },
3031
"env": {
3132
"CMD_VAR_LONG": "long",
3233
},
3334
"args": [
34-
// "--verbose",
35+
"--verbose",
3536
// "--format",
3637
// "toml",
3738
// "robot"
@@ -57,13 +58,15 @@
5758
// ".."
5859
// "config",
5960
// "show",
60-
"discover",
61-
"tests"
61+
// "discover",
62+
// "tests"
6263
// "-d", "output",
6364
// "-i",
6465
// "-v", "CMD_LINE_VAR:cmd_line_var",
6566
// "E:\\source\\uvtestprj\\tests\\first.robotrepl"
66-
67+
"analyze",
68+
"code",
69+
"tests"
6770
]
6871
},
6972
{

docs/03_reference/cli.md

Lines changed: 94 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ robotcode [OPTIONS] COMMAND [ARGS]...
106106

107107
- [`analyze`](#analyze)
108108

109-
TODO: Analyzes a Robot Framework project.
109+
The analyze command provides various subcommands for analyzing Robot Framework code.
110110

111111
- [`clean`](#clean)
112112

@@ -174,12 +174,14 @@ robotcode [OPTIONS] COMMAND [ARGS]...
174174

175175
### analyze
176176

177-
TODO: Analyzes a Robot Framework project.
177+
The analyze command provides various subcommands for analyzing Robot
178+
Framework code. These subcommands support specialized tasks, such as code
179+
analysis, style checking or dependency graphs.
178180

179181

180182
**Usage:**
181183
```text
182-
robotcode analyze [OPTIONS] [PATHS]...
184+
robotcode analyze [OPTIONS] COMMAND [ARGS]...
183185
```
184186

185187

@@ -194,6 +196,44 @@ robotcode analyze [OPTIONS] [PATHS]...
194196
Show this message and exit.
195197

196198

199+
**Commands:**
200+
201+
- [`code`](#code)
202+
203+
Performs static code analysis to detect syntax errors, missing keywords or variables, missing arguments, and more on the given *PATHS*.
204+
205+
206+
#### code
207+
208+
Performs static code analysis to detect syntax errors, missing keywords or
209+
variables, missing arguments, and more on the given *PATHS*. *PATHS* can be
210+
files or directories. If no PATHS are given, the current directory is used.
211+
212+
213+
**Usage:**
214+
```text
215+
robotcode analyze code [OPTIONS] [PATHS]...
216+
```
217+
218+
219+
**Options:**
220+
- `--version`
221+
222+
Show the version and exit.
223+
224+
225+
- `-f, --filter TEXT`
226+
227+
Glob pattern to filter files to analyze. Can be specified multiple times.
228+
229+
230+
- `--help`
231+
232+
Show this message and exit.
233+
234+
235+
236+
197237
### clean
198238

199239
TODO: Cleans a Robot Framework project.
@@ -494,12 +534,12 @@ robotcode debug [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
494534

495535
- `--tcp [<ADDRESS>:]<PORT>`
496536

497-
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name, port, mode.
537+
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: mode, pipe-name, pipe-server, port.
498538

499539

500540
- `--pipe-server NAME`
501541

502-
Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: bind, tcp, mode, port, pipe-name.
542+
Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: port, pipe-name, tcp, bind, mode.
503543

504544

505545
- `--mode [pipe-server|tcp]`
@@ -509,17 +549,17 @@ robotcode debug [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
509549

510550
- `--port PORT`
511551

512-
The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name. [env var: ROBOTCODE_PORT; default: 6612; 1<=x<=65535]
552+
The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-name, pipe-server. [env var: ROBOTCODE_PORT; default: 6612; 1<=x<=65535]
513553

514554

515555
- `--bind ADDRESS`
516556

517-
Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name. [env var: ROBOTCODE_BIND; default: 127.0.0.1]
557+
Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-name, pipe-server. [env var: ROBOTCODE_BIND; default: 127.0.0.1]
518558

519559

520560
- `--pipe-name NAME`
521561

522-
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: pipe-server, port, tcp, bind. [env var: ROBOTCODE_PIPE_NAME]
562+
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: pipe-server, tcp, port, bind. [env var: ROBOTCODE_PIPE_NAME]
523563

524564

525565
- `--version`
@@ -546,47 +586,47 @@ robotcode debug-launch [OPTIONS]
546586
**Options:**
547587
- `--stdio`
548588

549-
Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: pipe-server, bind, socket, mode, tcp, port, pipe-name, pipe. [env var: ROBOTCODE_STDIO]
589+
Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: socket, port, pipe-name, pipe, pipe-server, tcp, bind, mode. [env var: ROBOTCODE_STDIO]
550590

551591

552592
- `--tcp [<ADDRESS>:]<PORT>`
553593

554-
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: pipe-server, socket, mode, stdio, port, pipe-name, pipe.
594+
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: socket, port, pipe-name, pipe, pipe-server, mode, stdio.
555595

556596

557597
- `--socket [<ADDRESS>:]<PORT>`
558598

559-
Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: pipe-server, tcp, mode, stdio, port, pipe-name, pipe.
599+
Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: port, pipe-name, pipe, pipe-server, tcp, mode, stdio.
560600

561601

562602
- `--pipe NAME`
563603

564-
Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: pipe-server, bind, socket, mode, tcp, stdio, port, pipe-name.
604+
Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: socket, port, pipe-name, pipe-server, tcp, bind, mode, stdio.
565605

566606

567607
- `--pipe-server NAME`
568608

569-
Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, tcp, stdio, port, pipe-name, pipe.
609+
Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: socket, port, pipe-name, pipe, tcp, bind, mode, stdio.
570610

571611

572612
- `--mode [stdio|tcp|socket|pipe|pipe-server]`
573613

574-
The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: pipe-server, tcp, socket, stdio, pipe. [env var: ROBOTCODE_MODE; default: stdio]
614+
The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: pipe-server, pipe, tcp, socket, stdio. [env var: ROBOTCODE_MODE; default: stdio]
575615

576616

577617
- `--port PORT`
578618

579-
The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name, pipe. [env var: ROBOTCODE_PORT; default: 6611; 1<=x<=65535]
619+
The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe, pipe-name. [env var: ROBOTCODE_PORT; default: 6611; 1<=x<=65535]
580620

581621

582622
- `--bind ADDRESS`
583623

584-
Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name, pipe. [env var: ROBOTCODE_BIND; default: 127.0.0.1]
624+
Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe, pipe-name. [env var: ROBOTCODE_BIND; default: 127.0.0.1]
585625

586626

587627
- `--pipe-name NAME`
588628

589-
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: pipe-server, bind, socket, tcp, stdio, port, pipe. [env var: ROBOTCODE_PIPE_NAME]
629+
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: port, pipe-server, pipe, tcp, bind, socket, stdio. [env var: ROBOTCODE_PIPE_NAME]
590630

591631

592632
- `--version`
@@ -691,6 +731,11 @@ robotcode discover all [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
691731
Show the tags that are present. [default: tags]
692732

693733

734+
- `--exclude-by-longname TEXT`
735+
736+
Excludes tests/tasks or suites by longname.
737+
738+
694739
- `--by-longname TEXT`
695740

696741
Select tests/tasks or suites by longname.
@@ -701,11 +746,6 @@ robotcode discover all [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
701746
Show the version and exit.
702747

703748

704-
- `--exclude-by-longname TEXT`
705-
706-
Excludes tests/tasks or suites by longname.
707-
708-
709749
- `--full-paths / --no-full-paths`
710750

711751
Show full paths instead of releative. [default: no-full-paths]
@@ -790,6 +830,11 @@ robotcode discover suites [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
790830

791831

792832
**Options:**
833+
- `--exclude-by-longname TEXT`
834+
835+
Excludes tests/tasks or suites by longname.
836+
837+
793838
- `--by-longname TEXT`
794839

795840
Select tests/tasks or suites by longname.
@@ -800,11 +845,6 @@ robotcode discover suites [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
800845
Show the version and exit.
801846

802847

803-
- `--exclude-by-longname TEXT`
804-
805-
Excludes tests/tasks or suites by longname.
806-
807-
808848
- `--full-paths / --no-full-paths`
809849

810850
Show full paths instead of releative. [default: no-full-paths]
@@ -862,6 +902,11 @@ robotcode discover tags [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
862902
Show full paths instead of releative. [default: no-full-paths]
863903

864904

905+
- `--exclude-by-longname TEXT`
906+
907+
Excludes tests/tasks or suites by longname.
908+
909+
865910
- `--by-longname TEXT`
866911

867912
Select tests/tasks or suites by longname.
@@ -872,11 +917,6 @@ robotcode discover tags [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
872917
Show the version and exit.
873918

874919

875-
- `--exclude-by-longname TEXT`
876-
877-
Excludes tests/tasks or suites by longname.
878-
879-
880920
- `--help`
881921

882922
Show this message and exit.
@@ -919,6 +959,11 @@ robotcode discover tasks [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
919959
Show full paths instead of releative. [default: no-full-paths]
920960

921961

962+
- `--exclude-by-longname TEXT`
963+
964+
Excludes tests/tasks or suites by longname.
965+
966+
922967
- `--by-longname TEXT`
923968

924969
Select tests/tasks or suites by longname.
@@ -929,11 +974,6 @@ robotcode discover tasks [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
929974
Show the version and exit.
930975

931976

932-
- `--exclude-by-longname TEXT`
933-
934-
Excludes tests/tasks or suites by longname.
935-
936-
937977
- `--help`
938978

939979
Show this message and exit.
@@ -976,6 +1016,11 @@ robotcode discover tests [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
9761016
Show full paths instead of releative. [default: no-full-paths]
9771017

9781018

1019+
- `--exclude-by-longname TEXT`
1020+
1021+
Excludes tests/tasks or suites by longname.
1022+
1023+
9791024
- `--by-longname TEXT`
9801025

9811026
Select tests/tasks or suites by longname.
@@ -986,11 +1031,6 @@ robotcode discover tests [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
9861031
Show the version and exit.
9871032

9881033

989-
- `--exclude-by-longname TEXT`
990-
991-
Excludes tests/tasks or suites by longname.
992-
993-
9941034
- `--help`
9951035

9961036
Show this message and exit.
@@ -1016,27 +1056,27 @@ robotcode language-server [OPTIONS] [PATHS]...
10161056
**Options:**
10171057
- `--stdio`
10181058

1019-
Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, tcp, port, pipe-name, pipe. [env var: ROBOTCODE_STDIO]
1059+
Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: socket, port, pipe-name, pipe, tcp, bind, mode. [env var: ROBOTCODE_STDIO]
10201060

10211061

10221062
- `--tcp [<ADDRESS>:]<PORT>`
10231063

1024-
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: socket, mode, stdio, port, pipe-name, pipe.
1064+
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: socket, port, pipe-name, pipe, mode, stdio.
10251065

10261066

10271067
- `--socket [<ADDRESS>:]<PORT>`
10281068

1029-
Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: tcp, mode, stdio, port, pipe-name, pipe.
1069+
Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: port, pipe-name, pipe, tcp, mode, stdio.
10301070

10311071

10321072
- `--pipe NAME`
10331073

1034-
Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, tcp, stdio, port, pipe-name.
1074+
Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: socket, port, pipe-name, tcp, bind, mode, stdio.
10351075

10361076

1037-
- `--mode [stdio|tcp|pipe|socket]`
1077+
- `--mode [socket|stdio|pipe|tcp]`
10381078

1039-
The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: stdio, tcp, socket, pipe. [env var: ROBOTCODE_MODE; default: stdio]
1079+
The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: socket, stdio, pipe, tcp. [env var: ROBOTCODE_MODE; default: stdio]
10401080

10411081

10421082
- `--port PORT`
@@ -1051,7 +1091,7 @@ robotcode language-server [OPTIONS] [PATHS]...
10511091

10521092
- `--pipe-name NAME`
10531093

1054-
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, socket, tcp, stdio, port, pipe. [env var: ROBOTCODE_PIPE_NAME]
1094+
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: port, pipe, tcp, bind, socket, stdio. [env var: ROBOTCODE_PIPE_NAME]
10551095

10561096

10571097
- `--version`
@@ -1286,6 +1326,11 @@ robotcode robot [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
12861326

12871327

12881328
**Options:**
1329+
- `--exclude-by-longname TEXT`
1330+
1331+
Excludes tests/tasks or suites by longname.
1332+
1333+
12891334
- `--by-longname TEXT`
12901335

12911336
Select tests/tasks or suites by longname.
@@ -1296,11 +1341,6 @@ robotcode robot [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
12961341
Show the version and exit.
12971342

12981343

1299-
- `--exclude-by-longname TEXT`
1300-
1301-
Excludes tests/tasks or suites by longname.
1302-
1303-
13041344
- `--help`
13051345

13061346
Show this message and exit.

0 commit comments

Comments
 (0)