Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: check-svg-bot upgrade #807

Merged
merged 2 commits into from
Aug 13, 2021
Merged
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: 1 addition & 5 deletions .github/scripts/check_svgs_on_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,14 @@ def check_svgs(svg_file_paths: List[Path]):
err_msg.append(f"-root is '{root.tag}'. Root must be an 'svg' element")

if root.get("viewBox") != "0 0 128 128":
err_msg.append("-'viewBox' is not '0 0 128 128' -> Set it or scale the file using https://www.iloveimg.com/resize-image/resize-svg")
err_msg.append("-'viewBox' is not '0 0 128 128' -> Set it or scale the file using https://www.iloveimg.com/resize-image/resize-svg.")

if root.get("x") is not None:
err_msg.append("-unneccessary 'x' attribute in svg root element -> Remove it")

if root.get("y") is not None:
err_msg.append("-unneccessary 'y' attribute in svg root element -> Remove it")

style = root.findtext(f".//{namespace}style")
if style != None and "fill" in style:
err_msg.append("-contains style declaration using 'fill' -> Replace classes with the 'fill' attribute instead")

if len(err_msg) > 1:
err_msgs.append("\n".join(err_msg))
except et.ParseError as e:
Expand Down