From 50fb0bc591fb127be181e123da204b6b9cc12f33 Mon Sep 17 00:00:00 2001 From: r-sharp Date: Tue, 10 Feb 2026 18:42:08 +0000 Subject: [PATCH 1/3] Adjust file types to be a set, making the inclusion of 'group' types trivial e.g. the CI group to run tests equivalent to the CI stage on a PR. --- script_umdp3_checker/umdp3_conformance.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/script_umdp3_checker/umdp3_conformance.py b/script_umdp3_checker/umdp3_conformance.py index 4c773efd..a984e0e2 100644 --- a/script_umdp3_checker/umdp3_conformance.py +++ b/script_umdp3_checker/umdp3_conformance.py @@ -19,6 +19,11 @@ """ +ALLOWABLE_FILE_TYPES = ["Fortran", "Python", "Generic"] +GROUP_FILE_TYPES = ["CI"] +# TODO: Generic /probably/ needs renaming. + + @dataclass class CheckResult: """Result from running a style checker on a file.""" @@ -412,13 +417,10 @@ def process_arguments(): "--file-types", type=str, nargs="+", - choices=["Fortran", "Python", "Generic"], + choices=ALLOWABLE_FILE_TYPES + GROUP_FILE_TYPES, default=["Fortran"], help="File types to check, comma-separated", ) - """ - TODO : I /think/ the old version also checked '.h' files as Fortran. - Not sure if that is still needed.""" parser.add_argument( "-p", "--path", type=str, default="./", help="path to repository" ) @@ -446,6 +448,7 @@ def process_arguments(): args = parser.parse_args() # Determine output verbosity level args.volume = 3 + args.verbose - args.quiet + args.file_types = detangle_file_types(set(args.file_types)) return args @@ -463,6 +466,15 @@ def which_cms_is_it(path: str) -> CMSSystem: raise RuntimeError("Unknown CMS type at path: " + str(path)) +def detangle_file_types(file_types: Set[str]) -> Set[str]: + """Process file type arguments to handle 'group' types.""" + if "CI" in file_types: + file_types.remove("CI") + file_types.add("Fortran") + file_types.add("Python") + return file_types + + def create_style_checkers( file_types: List[str], changed_files: List[Path] ) -> List[StyleChecker]: @@ -472,6 +484,9 @@ def create_style_checkers( if "Fortran" in file_types: file_extensions = {".f", ".for", ".f90", ".f95", ".f03", ".f08", ".F90"} + """ + TODO : I /think/ the old version also checked '.h' files as Fortran. + Not sure if that is still needed.""" fortran_diff_table = dispatch_tables.get_diff_dispatch_table_fortran() fortran_file_table = dispatch_tables.get_file_dispatch_table_fortran() generic_file_table = dispatch_tables.get_file_dispatch_table_all() From ba61d441f4599b2f016dbbbaa81f11500ba3b2e1 Mon Sep 17 00:00:00 2001 From: r-sharp Date: Tue, 17 Feb 2026 16:46:31 +0000 Subject: [PATCH 2/3] Changing allowable groups to be a dict. --- script_umdp3_checker/umdp3_conformance.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/script_umdp3_checker/umdp3_conformance.py b/script_umdp3_checker/umdp3_conformance.py index a984e0e2..e2bc1689 100644 --- a/script_umdp3_checker/umdp3_conformance.py +++ b/script_umdp3_checker/umdp3_conformance.py @@ -20,7 +20,9 @@ ALLOWABLE_FILE_TYPES = ["Fortran", "Python", "Generic"] -GROUP_FILE_TYPES = ["CI"] +GROUP_FILE_TYPES = { + "CI": ["Fortran", "Python"], +} # TODO: Generic /probably/ needs renaming. @@ -417,7 +419,7 @@ def process_arguments(): "--file-types", type=str, nargs="+", - choices=ALLOWABLE_FILE_TYPES + GROUP_FILE_TYPES, + choices=ALLOWABLE_FILE_TYPES + list(GROUP_FILE_TYPES.keys()), default=["Fortran"], help="File types to check, comma-separated", ) @@ -468,10 +470,10 @@ def which_cms_is_it(path: str) -> CMSSystem: def detangle_file_types(file_types: Set[str]) -> Set[str]: """Process file type arguments to handle 'group' types.""" - if "CI" in file_types: - file_types.remove("CI") - file_types.add("Fortran") - file_types.add("Python") + for group, members in GROUP_FILE_TYPES.items(): + if group in file_types: + file_types.remove(group) + file_types.update(members) return file_types From e3123750f894309cf17cc942c9f51b64eb05b7e7 Mon Sep 17 00:00:00 2001 From: r-sharp Date: Tue, 17 Feb 2026 17:25:02 +0000 Subject: [PATCH 3/3] Tiny Tweak to GROUP_FILE_TYPES, and extra checks --- script_umdp3_checker/umdp3_conformance.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/script_umdp3_checker/umdp3_conformance.py b/script_umdp3_checker/umdp3_conformance.py index e2bc1689..e0052c4c 100644 --- a/script_umdp3_checker/umdp3_conformance.py +++ b/script_umdp3_checker/umdp3_conformance.py @@ -21,7 +21,8 @@ ALLOWABLE_FILE_TYPES = ["Fortran", "Python", "Generic"] GROUP_FILE_TYPES = { - "CI": ["Fortran", "Python"], + "CI": {"Fortran", "Python"}, + "ALL": set(ALLOWABLE_FILE_TYPES), } # TODO: Generic /probably/ needs renaming. @@ -470,10 +471,20 @@ def which_cms_is_it(path: str) -> CMSSystem: def detangle_file_types(file_types: Set[str]) -> Set[str]: """Process file type arguments to handle 'group' types.""" + the_whole_world = set(ALLOWABLE_FILE_TYPES) + the_whole_world.update(list(GROUP_FILE_TYPES.keys())) for group, members in GROUP_FILE_TYPES.items(): if group in file_types: file_types.remove(group) file_types.update(members) + # A bit belt and braces, in case the contents of a group gets out of + # sync with what's allowable... + if file_types.difference(the_whole_world): + raise ValueError( + "Invalid file types specified: " + + f"{file_types.difference(the_whole_world)}" + + f" in group \"{group}\"" + ) return file_types