Determine which checker scopes apply to a file. Args: file_path: Absolute path to the file Returns: Set of scope names that apply to this file
(file_path: str)
| 711 | |
| 712 | |
| 713 | def _determine_file_scopes(file_path: str) -> set[str]: |
| 714 | """Determine which checker scopes apply to a file. |
| 715 | |
| 716 | Args: |
| 717 | file_path: Absolute path to the file |
| 718 | |
| 719 | Returns: |
| 720 | Set of scope names that apply to this file |
| 721 | """ |
| 722 | normalized_path = str(Path(file_path).resolve()) |
| 723 | posix_path = normalized_path.replace("\\", "/") |
| 724 | scopes: set[str] = set() |
| 725 | |
| 726 | # Determine file characteristics |
| 727 | is_src = "/src/" in posix_path |
| 728 | is_example = "/examples/" in posix_path |
| 729 | is_test = "/tests/" in posix_path |
| 730 | is_fl = "/src/fl/" in posix_path |
| 731 | is_lib8tion = "/src/lib8tion/" in posix_path |
| 732 | is_fx = "/src/fx/" in posix_path |
| 733 | is_sensors = "/src/sensors/" in posix_path |
| 734 | is_platforms = "/src/platforms/" in posix_path |
| 735 | is_platforms_shared = "/src/platforms/shared/" in posix_path |
| 736 | is_third_party = "/src/third_party/" in posix_path |
| 737 | |
| 738 | # Add scopes based on file location |
| 739 | if is_src or is_example or is_test: |
| 740 | scopes.add("global") |
| 741 | |
| 742 | if is_src: |
| 743 | scopes.add("src") |
| 744 | scopes.add("native_platform_defines") |
| 745 | |
| 746 | if is_platforms: |
| 747 | scopes.add("platforms") |
| 748 | scopes.add("platforms_banned") |
| 749 | |
| 750 | if is_example: |
| 751 | scopes.add("examples") |
| 752 | scopes.add("examples_banned") |
| 753 | |
| 754 | if is_fl: |
| 755 | scopes.add("fl") |
| 756 | scopes.add("fl_platforms_include_paths") |
| 757 | if normalized_path.endswith((".h", ".hpp", ".hxx", ".hh")): |
| 758 | scopes.add("fl_headers") |
| 759 | |
| 760 | if is_lib8tion: |
| 761 | scopes.add("lib8tion") |
| 762 | |
| 763 | if is_fx or is_sensors or is_platforms_shared: |
| 764 | scopes.add("fx_sensors_platforms_shared") |
| 765 | |
| 766 | if is_platforms: |
| 767 | scopes.add("fl_platforms_include_paths") |
| 768 | |
| 769 | if is_third_party: |
| 770 | scopes.add("third_party") |
no test coverage detected