Skip to content

Commit

Permalink
chore: single file & 3.6 import
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Aug 7, 2023
1 parent 2c829e6 commit b1d89cf
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 47 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ validate_pyproject.tool_schema =
setuptools = validate_pyproject.api:load_builtin_plugin
distutils = validate_pyproject.api:load_builtin_plugin
repo_review.checks =
validate_pyproject = validate_pyproject.repo_review.checks:repo_review_checks
validate_pyproject = validate_pyproject.repo_review:repo_review_checks
repo_review.families =
validate_pyproject = validate_pyproject.repo_review.families:repo_review_families
validate_pyproject = validate_pyproject.repo_review:repo_review_families

[tool:pytest]
# Specify command line options as you would do when invoking pytest directly.
Expand Down
36 changes: 36 additions & 0 deletions src/validate_pyproject/repo_review.py
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.
28 changes: 0 additions & 28 deletions src/validate_pyproject/repo_review/checks.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/validate_pyproject/repo_review/families.py

This file was deleted.

0 comments on commit b1d89cf

Please sign in to comment.