Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ pyright==1.1.390
ruff==0.8.2
httpx==0.27.2
questionary==2.1.0
pathspec==0.12.1
pathspec==0.12.1
bleach==6.2.0
6 changes: 2 additions & 4 deletions src/utilities/syntax_checker_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sass
from lxml import etree
import re
import bleach
from src.utilities.print_formatters import print_formatted


Expand Down Expand Up @@ -145,10 +146,7 @@ def parse_vue_basic(content):
if template_part_response != "Valid syntax":
return template_part_response

try:
script = re.search(r'<script[^>]*>(.*?)</script>', content, re.DOTALL).group(1)
except AttributeError:
return "Script part has no valid open/closing tags."
script = bleach.clean(content, tags=[], strip=True)
Copy link
Contributor

@radekrepo radekrepo Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked that bleach.clean() returns modified content without throwing an error also when tags are incorrectly formatted, unlike the previous version of this script.

If this is the intention of using bleach.clean(), then all good. Otherwise, it may be hard to interpret for user the behaviour of the script.

Examples of html work with bleach.clean() without throwing an error:

html = """<p   >This <a href="book"> book </a attr="test"> will help you</p  >"""
html = """<p   >This <a href="book"> book </a attr="test"> will help you< >""" 

note the missing closing of "/p" in the second object

Copy link
Contributor

@radekrepo radekrepo Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old version of code threw an AttributeError on both example objects. It may be a bit too sensitive because the upper example looks like it has all of the opening & closing tags. It was only missing correctly formatted <script> and </script> tags.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may misunderstand the importance of the "script" tag.

script_part_response = check_bracket_balance(script)
if script_part_response != "Valid syntax":
return script_part_response
Expand Down