mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 07:09:41 +00:00
Everywhere: Format all python files with black
This commit is contained in:
parent
9e8336c04f
commit
2f9957c618
Notes:
github-actions[bot]
2025-05-22 14:22:50 +00:00
Author: https://github.com/trflynn89
Commit: 2f9957c618
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4841
Reviewed-by: https://github.com/gmta ✅
18 changed files with 338 additions and 350 deletions
|
@ -16,16 +16,16 @@ lines_to_skip = re.compile(
|
|||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--overwrite-inplace", action=argparse.BooleanOptionalAction)
|
||||
parser.add_argument('filenames', nargs='*')
|
||||
parser.add_argument("filenames", nargs="*")
|
||||
args = parser.parse_args()
|
||||
|
||||
SINGLE_PAGE_HTML_SPEC_LINK = re.compile('//.*https://html\\.spec\\.whatwg\\.org/#')
|
||||
SINGLE_PAGE_HTML_SPEC_LINK = re.compile("//.*https://html\\.spec\\.whatwg\\.org/#")
|
||||
|
||||
|
||||
def should_check_file(filename):
|
||||
if not filename.endswith(".idl"):
|
||||
return False
|
||||
if filename.startswith('Tests/LibWeb/'):
|
||||
if filename.startswith("Tests/LibWeb/"):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -62,23 +62,24 @@ def run():
|
|||
continue
|
||||
did_fail = True
|
||||
files_without_four_leading_spaces.add(filename)
|
||||
print(
|
||||
f"{filename}:{line_number} error: Line does not start with four spaces:{line.rstrip()}")
|
||||
print(f"{filename}:{line_number} error: Line does not start with four spaces:{line.rstrip()}")
|
||||
lines.append(line)
|
||||
if args.overwrite_inplace:
|
||||
with open(filename, "w") as f:
|
||||
f.writelines(lines)
|
||||
|
||||
if files_without_four_leading_spaces:
|
||||
print("\nWebIDL files that have lines without four leading spaces:",
|
||||
" ".join(files_without_four_leading_spaces))
|
||||
print(
|
||||
"\nWebIDL files that have lines without four leading spaces:", " ".join(files_without_four_leading_spaces)
|
||||
)
|
||||
if not args.overwrite_inplace:
|
||||
print(
|
||||
f"\nTo fix the WebIDL files in place, run: ./Meta/{script_name} --overwrite-inplace")
|
||||
print(f"\nTo fix the WebIDL files in place, run: ./Meta/{script_name} --overwrite-inplace")
|
||||
|
||||
if files_with_single_page_html_spec_link:
|
||||
print("\nWebIDL files that have links to the single-page HTML spec:",
|
||||
" ".join(files_with_single_page_html_spec_link))
|
||||
print(
|
||||
"\nWebIDL files that have links to the single-page HTML spec:",
|
||||
" ".join(files_with_single_page_html_spec_link),
|
||||
)
|
||||
|
||||
if did_fail:
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue