Improve formatting in core files (#135256)
* Adjust core files formatting * Adjust translations script
This commit is contained in:
@@ -231,8 +231,7 @@ def validate(integrations: dict[str, Integration], config: Config) -> None:
|
||||
if integrations_path.read_text() != content + "\n":
|
||||
config.add_error(
|
||||
"config_flow",
|
||||
"File integrations.json is not up to date. "
|
||||
"Run python3 -m script.hassfest",
|
||||
"File integrations.json is not up to date. Run python3 -m script.hassfest",
|
||||
fixable=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ def validate(
|
||||
config_flow = ast_parse_module(config_flow_file)
|
||||
if not (_has_discovery_function(config_flow)):
|
||||
return [
|
||||
f"Integration is missing one of {CONFIG_FLOW_STEPS} "
|
||||
f"in {config_flow_file}"
|
||||
f"Integration is missing one of {CONFIG_FLOW_STEPS} in {config_flow_file}"
|
||||
]
|
||||
|
||||
return None
|
||||
|
||||
@@ -510,8 +510,8 @@ def validate_translation_file( # noqa: C901
|
||||
):
|
||||
integration.add_error(
|
||||
"translations",
|
||||
"Don't specify title in translation strings if it's a brand "
|
||||
"name or add exception to ALLOW_NAME_TRANSLATION",
|
||||
"Don't specify title in translation strings if it's "
|
||||
"a brand name or add exception to ALLOW_NAME_TRANSLATION",
|
||||
)
|
||||
|
||||
if config.specific_integrations:
|
||||
@@ -532,12 +532,15 @@ def validate_translation_file( # noqa: C901
|
||||
if parts or key not in search:
|
||||
integration.add_error(
|
||||
"translations",
|
||||
f"{reference['source']} contains invalid reference {reference['ref']}: Could not find {key}",
|
||||
f"{reference['source']} contains invalid reference"
|
||||
f"{reference['ref']}: Could not find {key}",
|
||||
)
|
||||
elif match := re.match(RE_REFERENCE, search[key]):
|
||||
integration.add_error(
|
||||
"translations",
|
||||
f"Lokalise supports only one level of references: \"{reference['source']}\" should point to directly to \"{match.groups()[0]}\"",
|
||||
"Lokalise supports only one level of references: "
|
||||
f'"{reference["source"]}" should point to directly '
|
||||
f'to "{match.groups()[0]}"',
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ def gather_new_integration(determine_auth: bool) -> Info:
|
||||
"prompt": (
|
||||
f"""How will your integration gather data?
|
||||
|
||||
Valid values are {', '.join(SUPPORTED_IOT_CLASSES)}
|
||||
Valid values are {", ".join(SUPPORTED_IOT_CLASSES)}
|
||||
|
||||
More info @ https://developers.home-assistant.io/docs/creating_integration_manifest#iot-class
|
||||
"""
|
||||
|
||||
@@ -79,7 +79,7 @@ class BucketHolder:
|
||||
"""Create output file."""
|
||||
with Path("pytest_buckets.txt").open("w") as file:
|
||||
for idx, bucket in enumerate(self._buckets):
|
||||
print(f"Bucket {idx+1} has {bucket.total_tests} tests")
|
||||
print(f"Bucket {idx + 1} has {bucket.total_tests} tests")
|
||||
file.write(bucket.get_paths_line())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user