cli/validate: allow exempting certain markers from validation
This commit is contained in:
@@ -8,8 +8,11 @@ from marker_sets import WORLDS
|
||||
|
||||
def main() -> None:
|
||||
result_is_ok = True
|
||||
|
||||
worlds_to_be_validated = remove_markers_not_to_be_validated(WORLDS)
|
||||
|
||||
for test_name, test_f in _tests.items():
|
||||
results = test_f(WORLDS)
|
||||
results = test_f(worlds_to_be_validated)
|
||||
if len(results) > 0:
|
||||
result_is_ok = False
|
||||
print(f"[X] {test_name}")
|
||||
@@ -87,6 +90,28 @@ class ValidationErrorPoint:
|
||||
return f"({self.x}, {self.y}, {self.z})"
|
||||
|
||||
|
||||
def remove_markers_not_to_be_validated(
|
||||
worlds: dict[str, list[MarkerSet]],
|
||||
) -> dict[str, list[MarkerSet]]:
|
||||
result = {}
|
||||
|
||||
for world_name, marker_sets in worlds.items():
|
||||
result[world_name] = []
|
||||
for marker_set in marker_sets:
|
||||
new_marker_set = MarkerSet(
|
||||
name=marker_set.name,
|
||||
show_by_default=marker_set.show_by_default,
|
||||
markers=[
|
||||
marker
|
||||
for marker in marker_set.markers
|
||||
if not marker.skip_validation
|
||||
],
|
||||
)
|
||||
result[world_name].append(new_marker_set)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def validate_no_non_included_files(
|
||||
worlds: dict[str, list[MarkerSet]],
|
||||
) -> list[ValidationError]:
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .marker import Marker
|
||||
|
||||
|
||||
@dataclass
|
||||
class Area(Marker):
|
||||
points: list[tuple[int, int, int]]
|
||||
icon: str | None = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
points: list[tuple[int, int, int]],
|
||||
icon: str | None = None,
|
||||
skip_validation: bool = False,
|
||||
) -> None:
|
||||
super().__init__(name, skip_validation)
|
||||
self.points = points
|
||||
self.icon = icon
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from abc import ABC
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Marker(ABC):
|
||||
name: str
|
||||
skip_validation: bool = False
|
||||
# icon: str | None = None
|
||||
|
||||
def __init__(self, name: str, skip_validation: bool = False) -> None:
|
||||
self.name = name
|
||||
self.skip_validation = skip_validation
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .marker import Marker
|
||||
|
||||
|
||||
@dataclass
|
||||
class Point(Marker):
|
||||
x: int
|
||||
y: int
|
||||
z: int
|
||||
icon: str | None = None
|
||||
skip_validation: bool = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
x: int,
|
||||
y: int,
|
||||
z: int,
|
||||
icon: str | None = None,
|
||||
skip_validation: bool = False,
|
||||
) -> None:
|
||||
super().__init__(name, skip_validation)
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.z = z
|
||||
self.icon = icon
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .marker import Marker
|
||||
|
||||
|
||||
@dataclass
|
||||
class Track(Marker):
|
||||
points: list[tuple[int, int, int]]
|
||||
icon: str | None = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
points: list[tuple[int, int, int]],
|
||||
icon: str | None = None,
|
||||
skip_validation: bool = False,
|
||||
) -> None:
|
||||
super().__init__(name, skip_validation)
|
||||
self.points = points
|
||||
self.icon = icon
|
||||
|
||||
Reference in New Issue
Block a user