-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
- Loading branch information
Showing
5 changed files
with
38 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import Any, Dict | ||
|
||
import fastjsonschema | ||
|
||
from .. import api, plugins | ||
|
||
__all__ = ["VPP001", "repo_review_checks", "repo_review_families"] | ||
|
||
|
||
class VPP001: | ||
"""Validate pyproject.toml""" | ||
|
||
family = "validate-pyproject" | ||
|
||
@staticmethod | ||
def check(pyproject: Dict[str, Any]) -> str: | ||
validator = api.Validator() | ||
try: | ||
validator(pyproject) | ||
return "" | ||
except fastjsonschema.JsonSchemaValueException as e: | ||
return f"Invalid pyproject.toml! Error: {e}" | ||
|
||
|
||
def repo_review_checks() -> Dict[str, VPP001]: | ||
return {"VPP001": VPP001()} | ||
|
||
|
||
def repo_review_families(pyproject: Dict[str, Any]) -> Dict[str, Dict[str, str]]: | ||
has_distutils = "distutils" in pyproject.get("tool", {}) | ||
plugin_names = (ep.name for ep in plugins.iterate_entry_points()) | ||
plugin_list = ( | ||
f"`[tool.{n}]`" for n in plugin_names if n != "distutils" or has_distutils | ||
) | ||
descr = f"Checks `[build-system]`, `[project]`, {', '.join(plugin_list)}" | ||
return {"validate-pyproject": {"name": "Validate-PyProject", "description": descr}} |
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.