diff --git a/tests/trestlebot/tasks/test_assemble_task.py b/tests/trestlebot/tasks/test_assemble_task.py index ad963dc2..b1ab8f87 100644 --- a/tests/trestlebot/tasks/test_assemble_task.py +++ b/tests/trestlebot/tasks/test_assemble_task.py @@ -96,13 +96,13 @@ def test_assemble_task_with_skip(tmp_trestle_dir: str, skip_list: List[str]) -> mock = Mock(spec=AuthorObjectBase) - filter = ModelFilter(skip_list, ["*"]) + model_filter = ModelFilter(skip_list, ["*"]) assemble_task = AssembleTask( working_dir=tmp_trestle_dir, authored_model=AuthoredType.CATALOG.value, markdown_dir=cat_md_dir, - filter=filter, + model_filter=model_filter, ) with patch( diff --git a/tests/trestlebot/tasks/test_regenerate_task.py b/tests/trestlebot/tasks/test_regenerate_task.py index 4da542ec..63813497 100644 --- a/tests/trestlebot/tasks/test_regenerate_task.py +++ b/tests/trestlebot/tasks/test_regenerate_task.py @@ -87,13 +87,13 @@ def test_regenerate_task_with_skip(tmp_trestle_dir: str, skip_list: List[str]) - mock = Mock(spec=AuthorObjectBase) - filter = ModelFilter(skip_list, ["*"]) + model_filter = ModelFilter(skip_list, ["*"]) regenerate_task = RegenerateTask( working_dir=tmp_trestle_dir, authored_model=AuthoredType.CATALOG.value, markdown_dir=cat_md_dir, - filter=filter, + model_filter=model_filter, ) with patch( diff --git a/tests/trestlebot/tasks/test_rule_transform_task.py b/tests/trestlebot/tasks/test_rule_transform_task.py index dd55f3d1..0ea23344 100644 --- a/tests/trestlebot/tasks/test_rule_transform_task.py +++ b/tests/trestlebot/tasks/test_rule_transform_task.py @@ -117,9 +117,9 @@ def test_rule_transform_task_with_skip(tmp_trestle_dir: str) -> None: setup_rules_view(trestle_root, test_comp, test_rules_dir) transformer = ToRulesYAMLTransformer() - filter = ModelFilter([test_comp], []) + model_filter = ModelFilter([test_comp], []) rule_transform_task = RuleTransformTask( - tmp_trestle_dir, test_rules_dir, transformer, filter=filter + tmp_trestle_dir, test_rules_dir, transformer, model_filter=model_filter ) return_code = rule_transform_task.execute() assert return_code == 0 diff --git a/trestlebot/entrypoints/autosync.py b/trestlebot/entrypoints/autosync.py index 36fe0053..85651735 100644 --- a/trestlebot/entrypoints/autosync.py +++ b/trestlebot/entrypoints/autosync.py @@ -120,7 +120,8 @@ def run(self, args: argparse.Namespace) -> None: logger.error("Must set ssp_index_path when using SSP as oscal model.") sys.exit(const.ERROR_EXIT_CODE) - filter: ModelFilter = ModelFilter( + # Allow any model to be skipped from the args, by default include all + model_filter: ModelFilter = ModelFilter( skip_patterns=comma_sep_to_list(args.skip_items), include_patterns=["*"], ) @@ -133,7 +134,7 @@ def run(self, args: argparse.Namespace) -> None: authored_model=args.oscal_model, markdown_dir=args.markdown_path, ssp_index_path=args.ssp_index_path, - filter=filter, + model_filter=model_filter, ) pre_tasks.append(assemble_task) else: @@ -145,7 +146,7 @@ def run(self, args: argparse.Namespace) -> None: authored_model=args.oscal_model, markdown_dir=args.markdown_path, ssp_index_path=args.ssp_index_path, - filter=filter, + model_filter=model_filter, ) pre_tasks.append(regenerate_task) else: diff --git a/trestlebot/entrypoints/create_cd.py b/trestlebot/entrypoints/create_cd.py index b46093b1..0b4c1fd1 100644 --- a/trestlebot/entrypoints/create_cd.py +++ b/trestlebot/entrypoints/create_cd.py @@ -115,7 +115,7 @@ def run(self, args: argparse.Namespace) -> None: # In this case we only want to do the transformation and generation for this component # definition, so we skip all other component definitions and components. - workspace_filter: ModelFilter = ModelFilter( + model_filter: ModelFilter = ModelFilter( [], [args.compdef_name, args.component_title, f"{RULE_PREFIX}*"] ) @@ -123,7 +123,7 @@ def run(self, args: argparse.Namespace) -> None: working_dir=args.working_dir, rules_view_dir=RULES_VIEW_DIR, rule_transformer=transformer, - filter=workspace_filter, + model_filter=model_filter, ) pre_tasks.append(rule_transform_task) @@ -131,7 +131,7 @@ def run(self, args: argparse.Namespace) -> None: working_dir=args.working_dir, authored_model=AuthoredType.COMPDEF.value, markdown_dir=args.markdown_path, - filter=workspace_filter, + model_filter=model_filter, ) pre_tasks.append(regenerate_task) diff --git a/trestlebot/entrypoints/rule_transform.py b/trestlebot/entrypoints/rule_transform.py index df197ffd..2557d27e 100644 --- a/trestlebot/entrypoints/rule_transform.py +++ b/trestlebot/entrypoints/rule_transform.py @@ -63,7 +63,8 @@ def run(self, args: argparse.Namespace) -> None: validation_handler: ValidationHandler = ValidationHandler(parameter_validation) transformer: ToRulesYAMLTransformer = ToRulesYAMLTransformer(validation_handler) - filter: ModelFilter = ModelFilter( + # Allow any model to be skipped from the args, by default include all + model_filter: ModelFilter = ModelFilter( skip_patterns=comma_sep_to_list(args.skip_items), include_patterns=["*"], ) @@ -72,7 +73,7 @@ def run(self, args: argparse.Namespace) -> None: working_dir=args.working_dir, rules_view_dir=args.rules_view_path, rule_transformer=transformer, - filter=filter, + model_filter=model_filter, ) pre_tasks: List[TaskBase] = [rule_transform_task] diff --git a/trestlebot/tasks/assemble_task.py b/trestlebot/tasks/assemble_task.py index a2f13d10..1baab9af 100644 --- a/trestlebot/tasks/assemble_task.py +++ b/trestlebot/tasks/assemble_task.py @@ -40,7 +40,7 @@ def __init__( authored_model: str, markdown_dir: str, ssp_index_path: str = "", - filter: Optional[ModelFilter] = None, + model_filter: Optional[ModelFilter] = None, ) -> None: """ Initialize assemble task. @@ -50,13 +50,14 @@ def __init__( authored_model: String representation of model type markdown_dir: Location of directory to write Markdown in ssp_index_path: Path of ssp index JSON in the workspace - filter: Optional filter to apply to the task to include or exclude models from processing + model_filter: Optional filter to apply to the task to include or exclude models + from processing """ self._authored_model = authored_model self._markdown_dir = markdown_dir self._ssp_index_path = ssp_index_path - super().__init__(working_dir, filter) + super().__init__(working_dir, model_filter) def execute(self) -> int: """Execute task""" diff --git a/trestlebot/tasks/base_task.py b/trestlebot/tasks/base_task.py index 6624d292..edbb1057 100644 --- a/trestlebot/tasks/base_task.py +++ b/trestlebot/tasks/base_task.py @@ -66,16 +66,16 @@ class TaskBase(ABC): Abstract base class for tasks with a work directory. """ - def __init__(self, working_dir: str, filter: Optional[ModelFilter]) -> None: + def __init__(self, working_dir: str, model_filter: Optional[ModelFilter]) -> None: """ Initialize base task. Args: working_dir: Working directory to complete operations in. - filter: Model filter to use for this task. + model_filter: Model filter to use for this task. """ self._working_dir = working_dir - self.filter: Optional[ModelFilter] = filter + self.filter: Optional[ModelFilter] = model_filter @property def working_dir(self) -> str: diff --git a/trestlebot/tasks/regenerate_task.py b/trestlebot/tasks/regenerate_task.py index 76b51402..22912159 100644 --- a/trestlebot/tasks/regenerate_task.py +++ b/trestlebot/tasks/regenerate_task.py @@ -40,7 +40,7 @@ def __init__( authored_model: str, markdown_dir: str, ssp_index_path: str = "", - filter: Optional[ModelFilter] = None, + model_filter: Optional[ModelFilter] = None, ) -> None: """ Initialize regenerate task. @@ -50,13 +50,14 @@ def __init__( authored_model: String representation of model type markdown_dir: Location of directory to write Markdown in ssp_index_path: Path of ssp index JSON in the workspace - filter: Optional filter to apply to the task to include or exclude models from processing. + model_filter: Optional filter to apply to the task to include or exclude models + from processing. """ self._authored_model = authored_model self._markdown_dir = markdown_dir self._ssp_index_path = ssp_index_path - super().__init__(working_dir, filter) + super().__init__(working_dir, model_filter) def execute(self) -> int: """Execute task""" diff --git a/trestlebot/tasks/rule_transform_task.py b/trestlebot/tasks/rule_transform_task.py index 0535b3d3..f416d87e 100644 --- a/trestlebot/tasks/rule_transform_task.py +++ b/trestlebot/tasks/rule_transform_task.py @@ -46,7 +46,7 @@ def __init__( working_dir: str, rules_view_dir: str, rule_transformer: ToRulesYAMLTransformer, - filter: Optional[ModelFilter] = None, + model_filter: Optional[ModelFilter] = None, ) -> None: """ Initialize transform task. @@ -55,7 +55,8 @@ def __init__( working_dir: Working directory to complete operations in rule_view_dir: Location of directory containing components with to read rules from rule_transformer: Transformer to use for rule transformation to TrestleRule - filter: Optional filter to apply to the task to include or exclude models from processing. + model_filter: Optional filter to apply to the task to include or exclude models + from processing. Notes: The rule_view_dir is expected to be a directory containing directories of @@ -66,7 +67,7 @@ def __init__( self._rule_view_dir = rules_view_dir self._rule_transformer: ToRulesYAMLTransformer = rule_transformer - super().__init__(working_dir, filter) + super().__init__(working_dir, model_filter) def execute(self) -> int: """Execute task"""