Skip to content

Commit

Permalink
Merge pull request #1 from burke-md/configFile
Browse files Browse the repository at this point in the history
Config file
  • Loading branch information
burke-md committed Nov 7, 2022
2 parents 659b71c + 60ee350 commit dbee70a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,29 @@ Options:
--incremental TEXT File where incremental mutation state is
stored
--config TEXT File to parse vertigo options from
--help Show this message and exit.
```
### Using Configuration File
At this time a limited set of options have been implemented.
A user can create a config file in the project root (see sample below) to limit the number of command line parameters used.
```bash
vertigo run --config vertigo_config.yml
```
Sample config file:
```
//vertigo_config.yml
hardhat_parallel: 8
output: output.txt
```
Note that unused fields in the config file should be `false`.
### Known Issues
**Ganache** is generally used only for a single run of the entire test suite.
Expand Down
18 changes: 15 additions & 3 deletions eth_vertigo/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import click
import yaml
from os import getcwd
from pathlib import Path
from eth_vertigo.core import MutationResult
Expand Down Expand Up @@ -32,8 +33,9 @@ def cli():
@click.option('--truffle-location', help="Location of truffle cli", nargs=1, type=str, default="truffle")
@click.option('--sample-ratio', help="If this option is set. Vertigo will apply the sample filter with the given ratio", nargs=1, type=float)
@click.option('--exclude', help="Vertigo won't mutate files in these directories", multiple=True)
@click.option('--incremental', help="File where incremental mutation state is stored",
type=str)
@click.option('--incremental', help="File where incremental mutation state is stored",type=str)
@click.option('--config', help="Pulls CLI parameters from .yml file. (requires file name)", nargs=1, type=str)

def run(
output,
network,
Expand All @@ -45,7 +47,8 @@ def run(
truffle_location,
sample_ratio,
exclude,
incremental
incremental,
config
):
""" Run command """
click.echo("[*] Starting mutation testing")
Expand All @@ -55,6 +58,8 @@ def run(
working_directory = getcwd()
project_type = _directory_type(working_directory)
filters = []
#config_hardhat_parallel = ""

if exclude:
filters.append(ExcludeFilter(exclude))

Expand All @@ -74,6 +79,13 @@ def run(
store = IncrementalMutationStore.from_file(incremental_store_file)
test_suggesters.append(IncrementalSuggester(store))

if config:
with open(config, 'r') as file:
config_params = yaml.safe_load(file)

output = config_params['output']
hardhat_parallel = config_params['hardhat_parallel']

click.echo("[*] Starting analysis on project")
project_path = Path(working_directory)

Expand Down

0 comments on commit dbee70a

Please sign in to comment.