• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

abravalheri / validate-pyproject / 5226968556240896

pending completion
5226968556240896

push

cirrus-ci

GitHub
Typo: validate-project => validate-pyproject (#78)

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/validate_pyproject/errors.py
1
from textwrap import dedent
8✔
2

3
from ._vendor.fastjsonschema import (
8✔
4
    JsonSchemaDefinitionException,
5
    JsonSchemaException,
6
    JsonSchemaValueException,
7
)
8
from .error_reporting import ValidationError
8✔
9

10

11
class InvalidSchemaVersion(JsonSchemaDefinitionException):
8✔
12
    """\
13
    All schemas used in the validator should be specified using the same version \
14
    as the toplevel schema ({version!r}).
15

16
    Schema for {name!r} has version {given!r}.
17
    """
18

19
    def __init__(self, name: str, given_version: str, required_version: str):
8✔
20
        msg = dedent(self.__doc__ or "").strip()
8✔
21
        msg = msg.format(name=name, version=required_version, given=given_version)
8✔
22
        super().__init__(msg)
8✔
23

24

25
class SchemaMissingId(JsonSchemaDefinitionException):
8✔
26
    """\
27
    All schemas used in the validator MUST define a unique toplevel `"$id"`.
28
    No `"$id"` was found for schema associated with {reference!r}.
29
    """
30

31
    def __init__(self, reference: str):
8✔
32
        msg = dedent(self.__doc__ or "").strip()
8✔
33
        super().__init__(msg.format(reference=reference))
8✔
34

35

36
class SchemaWithDuplicatedId(JsonSchemaDefinitionException):
8✔
37
    """\
38
    All schemas used in the validator MUST define a unique toplevel `"$id"`.
39
    `$id = {schema_id!r}` was found at least twice.
40
    """
41

42
    def __init__(self, schema_id: str):
8✔
43
        msg = dedent(self.__doc__ or "").strip()
8✔
44
        super().__init__(msg.format(schema_id=schema_id))
8✔
45

46

47
__all__ = [
8✔
48
    "InvalidSchemaVersion",
49
    "JsonSchemaDefinitionException",
50
    "JsonSchemaException",
51
    "JsonSchemaValueException",
52
    "SchemaMissingId",
53
    "SchemaWithDuplicatedId",
54
    "ValidationError",
55
]
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc