Skip to content

Commit f67766f

Browse files
committed
cli/fmt.py(style): Fix ruff linting issues
why: Address B007, SIM102, PERF102, and E501 linting violations to maintain code quality standards. what: - Replace unused loop variable with underscore prefix - Combine nested if statements using logical and operators - Use values() instead of items() when keys are not needed - Split long conditional statement across multiple lines for readability refs: ruff check compliance
1 parent 2379e73 commit f67766f

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/vcspull/cli/fmt.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,17 @@ def format_single_config(
199199
compact_to_verbose = 0
200200
url_to_repo = 0
201201

202-
for directory, repos in raw_config.items():
202+
for repos in raw_config.values():
203203
if isinstance(repos, dict):
204204
for repo_data in repos.values():
205205
if isinstance(repo_data, str):
206206
compact_to_verbose += 1
207-
elif isinstance(repo_data, dict):
208-
if "url" in repo_data and "repo" not in repo_data:
209-
url_to_repo += 1
207+
elif (
208+
isinstance(repo_data, dict)
209+
and "url" in repo_data
210+
and "repo" not in repo_data
211+
):
212+
url_to_repo += 1
210213

211214
if compact_to_verbose > 0:
212215
log.info(
@@ -235,17 +238,16 @@ def format_single_config(
235238

236239
# Check if any repos need sorting
237240
for directory, repos in raw_config.items():
238-
if isinstance(repos, dict):
239-
if list(repos.keys()) != sorted(repos.keys()):
240-
log.info(
241-
" %s•%s Repositories in %s%s%s will be sorted alphabetically",
242-
Fore.BLUE,
243-
Style.RESET_ALL,
244-
Fore.MAGENTA,
245-
directory,
246-
Style.RESET_ALL,
247-
)
248-
break
241+
if isinstance(repos, dict) and list(repos.keys()) != sorted(repos.keys()):
242+
log.info(
243+
" %s•%s Repositories in %s%s%s will be sorted alphabetically",
244+
Fore.BLUE,
245+
Style.RESET_ALL,
246+
Fore.MAGENTA,
247+
directory,
248+
Style.RESET_ALL,
249+
)
250+
break
249251

250252
if write:
251253
# Save formatted config

0 commit comments

Comments
 (0)