You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-9Lines changed: 26 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,33 @@
2
2
This repository provides an alternative implementation to [Polystat](https://github.com/polystat/polystat).
3
3
4
4
# Basic usage
5
+
6
+
> `polystat`
7
+
8
+
If no arguments are provided to `polystat`, it will read the configuration from the [HOCON](https://github.com/lightbend/config/blob/main/HOCON.md) config file in the current working directory. The default name for this file is `.polystat.conf` in the current working directory. If you want to read the configuration from the file located elsewhere, the following command can be used:
9
+
10
+
```
11
+
polystat --config path/to/hocon/config.conf
12
+
```
13
+
5
14
> `polystat list -c`
6
15
7
-
Prints all the available config keys. The configuration file format is [HOCON](https://github.com/lightbend/config/blob/main/HOCON.md). The default name for this file is `.polystat.conf` in the current working directory.
16
+
Prints all the available config keys.
17
+
> `polystat list`
18
+
19
+
Prints the rule IDs for all the available analyzers. By default, all of them are enabled, however you can exclude some / include only the ones you want using the following commands:
20
+
21
+
> `polystat eo --in tmp --exclude mutualrec --sarif`
8
22
9
-
> `polystat java --in src/main/java`
23
+
All the rules BUT the `mutualrec` will be executed.
24
+
25
+
26
+
> `polystat eo --in tmp --include mutualrec --include liskov --sarif`
27
+
28
+
Only `mutualrec` and `liskov` rules will be executed.
29
+
30
+
31
+
> `polystat java --in src/main/java --console`
10
32
11
33
Get the plain text console output from analyzing Java files. The Java files are in the directory `src/main/java`.
12
34
@@ -44,7 +66,7 @@ polystat list [--config | -c]
44
66
* The subcommand specifies which files should be analyzed (`.eo`, `.java` or `.py`). More languages can be added in the future.
45
67
* Analyzes the input files in the `--in` directory. If `--in` is not specified, defaults to reading the input language code from stdin.
46
68
*`--in` can also accept a path which leads to a file. In this case, only the specified file will be analyzed.
47
-
* The temporary files produced by analyzers are to be stored in `--tmp` directory. If `--tmp` is not specified, temporary files will be stored in the OS-created tempdir. Each target language may have a different structure of the files in the temporary directory. It is assumed that the `path` supplied by `--tmp` points to an empty directory. If not, the contents of the `path` will be purged.
69
+
* The temporary files produced by analyzers are to be stored in `--tmp` directory. If `--tmp` is not specified, temporary files will be stored in the OS-created tempdir. Each target language may have a different structure of the files in the temporary directory. It is assumed that the `path` supplied by `--tmp` points to an empty directory. If not, the contents of the `path` will be purged. If the `--tmp` option is specified but the directory it points to does not exist, it will be created.
48
70
49
71
## Configuration options
50
72
*`--include` and `--exclude` respectively define which rules should be included/excluded from the analysis run. These options are mutually exclusive, so specifying both should not be valid. If neither option is specified, all the available analyzers will be run. The list of available rule specifiers can be found via `polystat list` command.
@@ -55,7 +77,7 @@ If it's not present in the current working directory, download one from Maven Ce
55
77
## Output configuration
56
78
*`--sarif` option means that the command will produce the output in the [SARIF](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html) format in addition to output in other formats (if any).
57
79
*`--to { console | dir=<path>| file=<path> }` is a repeatable option that specifies where the output should be written. If this option is not specified, no output is produced.
58
-
*`--to dir=<path>` means that the files will be written to the given path. The path is assumed to be an empty directory. If it is not, its contents will be purged.
80
+
*`--to dir=<path>` means that the files will be written to the given path. The path is assumed to be an empty directory. If it is not, its contents will be purged. If the `path` is specified but the directory it points to does not exist, it will be created.
59
81
* If an additional output format is specified (e.g. `--sarif`), then the files created by the analyzer will be written in the respective subdirectory. For example, in case of `--sarif`, the SARIF files will be located in `path/sarif/`. The console output is not written anywhere. Therefore, if none of the output format options (e.g. `--sarif`) are specified, no files are produced.
60
82
* The output format options (e.g. `--sarif`) also determine the extension of the output files. In case of `--sarif` the extension would be `.sarif.json`.
61
83
* If `--in` option specifies a directory, the structure of the output directory will be similar to the structure of the input directory.
@@ -74,11 +96,6 @@ If it's not present in the current working directory, download one from Maven Ce
74
96
*`--help` displays some informative help message for commands.
75
97
*`--config <path>` allows to configure Polystat from the specified HOCON config file. If not specified, reads configs from the file `.polystat.conf` in the current working directory.
76
98
77
-
78
-
## Calling Polystat without arguments
79
-
If no arguments are provided to `polystat`, it will read the configuration from the HOCON config file in the current working directory.
80
-
81
-
82
99
# Development
83
100
## Setup
84
101
This is an sbt Scala project. In order to build the project you need the following:
0 commit comments