Enable Ruff PTH for the script directory (#124441)
* Enable Ruff PTH for the script directory * Address review comments * Fix translations script * Update script/hassfest/config_flow.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
7752789c3a
commit
1db68327f9
18 changed files with 125 additions and 163 deletions
|
@ -98,18 +98,15 @@ def validate(integrations: dict[str, Integration], config: Config) -> None:
|
|||
if config.specific_integrations:
|
||||
return
|
||||
|
||||
with open(str(codeowners_path)) as fp:
|
||||
if fp.read().strip() != content:
|
||||
config.add_error(
|
||||
"codeowners",
|
||||
"File CODEOWNERS is not up to date. Run python3 -m script.hassfest",
|
||||
fixable=True,
|
||||
)
|
||||
return
|
||||
if codeowners_path.read_text() != content + "\n":
|
||||
config.add_error(
|
||||
"codeowners",
|
||||
"File CODEOWNERS is not up to date. Run python3 -m script.hassfest",
|
||||
fixable=True,
|
||||
)
|
||||
|
||||
|
||||
def generate(integrations: dict[str, Integration], config: Config) -> None:
|
||||
"""Generate CODEOWNERS."""
|
||||
codeowners_path = config.root / "CODEOWNERS"
|
||||
with open(str(codeowners_path), "w") as fp:
|
||||
fp.write(f"{config.cache['codeowners']}\n")
|
||||
codeowners_path.write_text(f"{config.cache['codeowners']}\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue