diff --git a/README.md b/README.md index 974398b8..ee3ff526 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ options: --require-all, --no-require-all all checks are required regardless of the check type (e.g., Recommendation becomes Requirement) --checks CHECKS array of checks to run - --config CONFIG path to the configuration file (default: .beman-tidy.yml in repo root) + --config CONFIG path to the configuration file (default: .beman-tidy.yaml in repo root) ``` - Run beman-tidy on the exemplar repository **(default: dry-run mode)** @@ -143,9 +143,9 @@ beman-tidy path/to/exemplar --fix-inplace --verbose ## Configuration -`beman-tidy` attempts to read configuration for each source file from a `.beman-tidy.yml` file located in the root of your repository. You can also specify a custom configuration file path using the `--config` option. +`beman-tidy` attempts to read configuration for each source file from a `.beman-tidy.yaml` file located in the root of your repository. You can also specify a custom configuration file path using the `--config` option. -The following configuration options may be used in a `.beman-tidy.yml` file: +The following configuration options may be used in a `.beman-tidy.yaml` file: `ignored_paths` - A list of paths to be excluded from all checks. - To ignore a specific file, provide its full path relative to the repository root. diff --git a/beman_tidy/.beman-standard.yml b/beman_tidy/.beman-standard.yaml similarity index 100% rename from beman_tidy/.beman-standard.yml rename to beman_tidy/.beman-standard.yaml diff --git a/beman_tidy/.beman-tidy.yml b/beman_tidy/.beman-tidy.yaml similarity index 100% rename from beman_tidy/.beman-tidy.yml rename to beman_tidy/.beman-tidy.yaml diff --git a/beman_tidy/cli.py b/beman_tidy/cli.py index 2375b25d..9841cf1d 100755 --- a/beman_tidy/cli.py +++ b/beman_tidy/cli.py @@ -37,7 +37,7 @@ def parse_args(): "--checks", help="array of checks to run", type=str, default=None ) parser.add_argument( - "--config", help="path to the configuration file (default: .beman-tidy.yml in repo root)", type=str, default=None + "--config", help="path to the configuration file (default: .beman-tidy.yaml in repo root)", type=str, default=None ) args = parser.parse_args() diff --git a/beman_tidy/lib/checks/beman_standard/readme.py b/beman_tidy/lib/checks/beman_standard/readme.py index df64f8fc..33a8fed0 100644 --- a/beman_tidy/lib/checks/beman_standard/readme.py +++ b/beman_tidy/lib/checks/beman_standard/readme.py @@ -72,7 +72,7 @@ def __init__(self, repo_info, beman_standard_check_config): def check(self): """ self.config["values"] contains a fixed set of Beman badges, - check .beman-standard.yml for the desired format. + check .beman-standard.yaml for the desired format. """ def validate_badges(category, badges): diff --git a/beman_tidy/lib/utils/config.py b/beman_tidy/lib/utils/config.py index e15933e0..67e3a255 100644 --- a/beman_tidy/lib/utils/config.py +++ b/beman_tidy/lib/utils/config.py @@ -18,7 +18,7 @@ def validate_config(config): return True if not isinstance(ignored_paths, list): - print(f"Error: 'ignored_paths' in .beman-tidy.yml must be a list, but got {type(ignored_paths).__name__}.") + print(f"Error: 'ignored_paths' in .beman-tidy.yaml must be a list, but got {type(ignored_paths).__name__}.") return False mandatory_files = {"README.md", "LICENSE"} @@ -31,12 +31,12 @@ def validate_config(config): clean_path = path.rstrip("/") # Check for exact match if clean_path in mandatory_files: - print(f"Error: Cannot ignore mandatory file '{clean_path}' in .beman-tidy.yml") + print(f"Error: Cannot ignore mandatory file '{clean_path}' in .beman-tidy.yaml") return False # Check if ignoring root directory if clean_path == "." or clean_path == "": - print("Error: Cannot ignore root directory in .beman-tidy.yml") + print("Error: Cannot ignore root directory in .beman-tidy.yaml") return False return True @@ -46,7 +46,7 @@ def get_default_config_path(): """ Returns the path to the default configuration file. """ - return Path(__file__).parent.parent.parent / ".beman-standard.yml" + return Path(__file__).parent.parent.parent / ".beman-standard.yaml" def load_repo_config(repo_path, config_path=None): @@ -62,7 +62,7 @@ def load_repo_config(repo_path, config_path=None): if config_path: user_config_path = Path(config_path) else: - user_config_path = Path(repo_path) / ".beman-tidy.yml" + user_config_path = Path(repo_path) / ".beman-tidy.yaml" # Load user configuration if it exists user_config = {} diff --git a/beman_tidy/lib/utils/git.py b/beman_tidy/lib/utils/git.py index 96cbcb53..46b40a75 100644 --- a/beman_tidy/lib/utils/git.py +++ b/beman_tidy/lib/utils/git.py @@ -127,7 +127,7 @@ def get_beman_standard_config_path(): """ Get the path to the Beman Standard YAML configuration file. """ - return Path(__file__).parent.parent.parent / ".beman-standard.yml" + return Path(__file__).parent.parent.parent / ".beman-standard.yaml" def get_beman_recommendated_license_path(): diff --git a/tests/lib/utils/test_config.py b/tests/lib/utils/test_config.py index bb459ef5..88922bfb 100644 --- a/tests/lib/utils/test_config.py +++ b/tests/lib/utils/test_config.py @@ -24,7 +24,7 @@ def test_validate_config_ignored_paths_not_list(capsys): } assert validate_config(config) is False captured = capsys.readouterr() - assert "Error: 'ignored_paths' in .beman-tidy.yml must be a list" in captured.out + assert "Error: 'ignored_paths' in .beman-tidy.yaml must be a list" in captured.out def test_validate_config_ignored_paths_invalid_entry(capsys): """Test that validation fails if ignored_paths contains non-string entries.""" @@ -78,7 +78,7 @@ def test_load_repo_config_default(tmp_path): } expected_config.update(user_config_content) - config_file = tmp_path / ".beman-tidy.yml" + config_file = tmp_path / ".beman-tidy.yaml" with open(config_file, "w") as f: yaml.dump(user_config_content, f) @@ -96,7 +96,7 @@ def test_load_repo_config_custom_path(tmp_path): } expected_config.update(user_config_content) - config_file = tmp_path / "custom_config.yml" + config_file = tmp_path / "custom_config.yaml" with open(config_file, "w") as f: yaml.dump(user_config_content, f) @@ -115,14 +115,14 @@ def test_load_repo_config_not_found_default(tmp_path): def test_load_repo_config_not_found_custom(tmp_path, capsys): """Test loading when a custom configuration file does not exist.""" with pytest.raises(SystemExit): - load_repo_config(tmp_path, config_path=str(tmp_path / "nonexistent.yml")) + load_repo_config(tmp_path, config_path=str(tmp_path / "nonexistent.yaml")) captured = capsys.readouterr() assert "Error: Configuration file specified not found" in captured.out def test_load_repo_config_invalid_yaml(tmp_path, capsys): """Test loading an invalid YAML file.""" - config_file = tmp_path / ".beman-tidy.yml" + config_file = tmp_path / ".beman-tidy.yaml" with open(config_file, "w") as f: f.write("invalid: yaml: :") @@ -137,7 +137,7 @@ def test_load_repo_config_invalid_validation(tmp_path, capsys): config_content = { "ignored_paths": ["README.md"] } - config_file = tmp_path / ".beman-tidy.yml" + config_file = tmp_path / ".beman-tidy.yaml" with open(config_file, "w") as f: yaml.dump(config_content, f) diff --git a/tests/utils/path_runners.py b/tests/utils/path_runners.py index 64535d60..f5d20693 100644 --- a/tests/utils/path_runners.py +++ b/tests/utils/path_runners.py @@ -20,7 +20,7 @@ def run_check_for_each_repo_info( {"default_branch": "master", ...}, ] check_class = RepositoryDefaultBranchCheck - beman_standard_check_config = "/path/to/.beman-standard.yml" + beman_standard_check_config = "/path/to/.beman-standard.yaml" """ for repo_info in repo_infos: check_instance = check_class(repo_info, beman_standard_check_config) @@ -46,7 +46,7 @@ def run_check_for_each_path( ] check_class = ReadmeTitleCheck or DirectorySourcesCheck repo_info = "beman.exemplar" - beman_standard_check_config = "/path/to/.beman-standard.yml" + beman_standard_check_config = "/path/to/.beman-standard.yaml" """ for path in paths: if os.path.isdir(path): @@ -87,7 +87,7 @@ def run_fix_inplace_for_each_file_path( ] check_class = ReadmeTitleCheck repo_info = "beman.exemplar" - beman_standard_check_config = "beman_tidy/.beman-standard.yml" + beman_standard_check_config = "beman_tidy/.beman-standard.yaml" """ for invalid_path in invalid_file_paths: check_instance = check_class(repo_info, beman_standard_check_config)