Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
13 changes: 13 additions & 0 deletions spectacles/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def main():
remote_reset=args.remote_reset,
severity=args.severity,
pin_imports=pin_imports,
print_json=args.json
)
)

Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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)
Expand All @@ -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(
Expand Down