Skip to content

Commit 9f39d6e

Browse files
committed
updated README.md
1 parent 3a4e512 commit 9f39d6e

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,33 @@
22
This repository provides an alternative implementation to [Polystat](https://github.com/polystat/polystat).
33

44
# 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+
514
> `polystat list -c`
615
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`
822
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`
1032
1133
Get the plain text console output from analyzing Java files. The Java files are in the directory `src/main/java`.
1234

@@ -44,7 +66,7 @@ polystat list [--config | -c]
4466
* The subcommand specifies which files should be analyzed (`.eo`, `.java` or `.py`). More languages can be added in the future.
4567
* Analyzes the input files in the `--in` directory. If `--in` is not specified, defaults to reading the input language code from stdin.
4668
* `--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.
4870

4971
## Configuration options
5072
* `--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
5577
## Output configuration
5678
* `--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).
5779
* `--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.
5981
* 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.
6082
* 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`.
6183
* 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
7496
* `--help` displays some informative help message for commands.
7597
* `--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.
7698

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-
8299
# Development
83100
## Setup
84101
This is an sbt Scala project. In order to build the project you need the following:

0 commit comments

Comments
 (0)