diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c6b60733..1a776837 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ Follow [these standard instructions](https://opensource.guide/how-to-contribute/ * Fork the repository on GitHub * Clone your fork to your local machine * Create a new local branch off `master` using the `feature/feature-name` branch naming convention -* Create a Python virtual environment and install dependencies with `pip install -r requirements.txt` +* Create a Python virtual environment and install dependencies with `pip install -r dev-requirements.txt` Once your local repository is set up, develop away on your feature! Double-check that you've included the following: diff --git a/spectacles/cli.py b/spectacles/cli.py index 45e64db9..e1e8847b 100644 --- a/spectacles/cli.py +++ b/spectacles/cli.py @@ -343,6 +343,7 @@ def main(): remote_reset=args.remote_reset, severity=args.severity, pin_imports=pin_imports, + print_json=args.json ) ) @@ -570,6 +571,13 @@ def _build_lookml_subparser( "validator to fail. The default is 'warning'." ), ) + subparser.add_argument( + "--json", + action="store_true", + help=( + "Output the results as a json" + ) + ) _build_validator_subparser(subparser_action, subparser) @@ -747,6 +755,7 @@ async def run_lookml( remote_reset, severity, pin_imports, + print_json = False ) -> None: # Don't trust env to ignore .netrc credentials async_client = httpx.AsyncClient(trust_env=False) @@ -760,6 +769,10 @@ async def run_lookml( finally: await async_client.aclose() + if print_json: + logger.info(json.dumps(results,None,2)) + return + errors = sorted(results["errors"], key=lambda x: x["metadata"]["file_path"] or "a") unique_files = sorted( set(