Remove subproject as a constructor argument

There's only one subproject and that's unlikely to change, so being able to
specify a subproject at runtime is overkill.

Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
Gilles Peskine
2025-09-23 16:14:57 +02:00
parent 8943efa136
commit fcfe1920c4
@@ -109,18 +109,14 @@ class Internal(Checker):
class SubprojectInternal(Checker):
"""Checker for an internal macro of a subproject."""
# meant to be overridden in child classes
# must be overridden in child classes
SUBPROJECT = None #type: Optional[str]
def __init__(self, name: str, suggestion: str = '',
subproject: Optional[str] = None) -> None:
def __init__(self, name: str, suggestion: str = '') -> None:
super().__init__(name, suggestion)
if subproject is not None:
self.subproject = subproject
elif self.SUBPROJECT is not None:
self.subproject = self.SUBPROJECT
else:
if self.SUBPROJECT is None:
raise ValueError('No subproject specified for ' + name)
self.subproject = self.SUBPROJECT #type: str
def _basic_message(self) -> str:
return f'{self.name} is an internal macro of {self.subproject} and may not be configured.'
@@ -150,9 +146,6 @@ class SubprojectInternal(Checker):
class SubprojectOption(SubprojectInternal):
"""Checker for a configuration option of a subproject."""
def __init__(self, name: str, subproject: Optional[str] = None) -> None:
super().__init__(name, subproject=subproject)
def _basic_message(self) -> str:
return f'{self.name} must be configured in {self.subproject}.'