Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)**
Expand Down Expand Up @@ -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.
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion beman_tidy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion beman_tidy/lib/checks/beman_standard/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions beman_tidy/lib/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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
Expand All @@ -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):
Expand All @@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion beman_tidy/lib/utils/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
12 changes: 6 additions & 6 deletions tests/lib/utils/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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: :")

Expand All @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions tests/utils/path_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
Loading