Skip to content

Commit 200d4a9

Browse files
authored
Fix JSON output (#831)
* fix linting Signed-off-by: Alex Goodman <[email protected]> * remove printing dir at top of status func Signed-off-by: Alex Goodman <[email protected]> --------- Signed-off-by: Alex Goodman <[email protected]>
1 parent 7f4ba91 commit 200d4a9

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/vunnel/cli/cli.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ def clear_provider(cfg: config.Application, provider_names: str, _input: bool, r
186186
@click.option("--json", "output_json", default=False, is_flag=True, help="output as JSON")
187187
@click.pass_obj
188188
def status_provider(cfg: config.Application, provider_names: str, show_empty: bool, output_json: bool) -> None: # noqa: C901
189-
print(cfg.root)
190189
selected_names = provider_names if provider_names else providers.names()
191190

192191
@dataclass
@@ -209,12 +208,12 @@ def format(self, fill: str) -> str:
209208
{fill} results: {self.count}
210209
{fill} from: {self.date}"""
211210

212-
def to_dict(self) -> dict:
211+
def to_dict(self) -> dict[str, Any]:
213212
return {
214-
'count': self.count,
215-
'date': self.date,
216-
'error': self.error,
217-
'enabled': self.enabled
213+
"count": self.count,
214+
"date": self.date,
215+
"error": self.error,
216+
"enabled": self.enabled,
218217
}
219218

220219
# first pass: find the results that exist (which may be fewer than what is selected)
@@ -244,9 +243,9 @@ def to_dict(self) -> dict:
244243
"providers": [
245244
{"name": name, **result.to_dict()} # unpack to a dict
246245
for name, result in sorted(results.items())
247-
]
246+
],
248247
}
249-
print(json.dumps(json_output, indent=2))
248+
print(json.dumps(json_output, indent=2)) # noqa: TID251 # TID251: json.dumps() isn't needed for this use case
250249
# otherwise, output as a tree structure
251250
else:
252251
# existing tree output

src/vunnel/providers/wolfi/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Parser:
1616
_secdb_dir_ = "secdb"
1717
_security_reference_url_ = "https://images.chainguard.dev/security"
1818

19-
def __init__( # noqa: PLR0913
19+
def __init__( # noqa: PLR0913
2020
self,
2121
workspace,
2222
url: str,

0 commit comments

Comments
 (0)