-
Notifications
You must be signed in to change notification settings - Fork 0
Sanitize MD and initiate addition of tests #43
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
65ba4e8
9ace6e3
b3ccc84
8af3feb
65e4d0c
4978b8a
190f483
9adbdb1
15047f1
6b57e0e
0d6d737
5ef9981
b56188a
ceedd36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,12 @@ install_requires = | |
| PyGithub ~= 2.0 | ||
| ruamel.yaml ~= 0.15 | ||
|
|
||
| [options.extras_require] | ||
| test = | ||
| mypy | ||
| pytest | ||
| pytest-cov | ||
|
||
|
|
||
| [options.packages.find] | ||
| where = src | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -250,7 +250,7 @@ def to_markdown(self) -> str: | |
| if user is None: | ||
| user = i.user.login | ||
| s += ( | ||
| f"- [{i.title}]({i.html_url}) by {user}" | ||
| f"- [{sanitize_md(i.title)}]({i.html_url}) by {user}" | ||
yarikoptic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| f" [{i.repository.full_name}]\n" | ||
| ) | ||
|
|
||
|
|
@@ -437,6 +437,11 @@ def ensure_aware(dt: datetime) -> datetime: | |
| return dt.replace(tzinfo=timezone.utc) if dt.tzinfo is None else dt | ||
|
|
||
|
|
||
| def sanitize_md(s: str) -> str: | ||
| # Remove `[]` symbols to ensure correct markdown in the references | ||
| return re.sub(r'[\[\]]', '', s) | ||
|
||
|
|
||
|
|
||
| @click.command() | ||
| @click.option( | ||
| "-c", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from ..__main__ import sanitize_md | ||
|
||
|
|
||
|
|
||
| def test_sanitize_md() -> None: | ||
| assert sanitize_md("[gh-actions](deps): Bump") == "gh-actions(deps): Bump" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,13 @@ | ||
| [tox] | ||
| envlist = lint,typing | ||
| envlist = lint,typing,py3 | ||
| isolated_build = True | ||
| minversion = 3.3.0 | ||
|
|
||
| [testenv] | ||
| extras = test | ||
| commands = | ||
| python -m pytest -v {posargs} src | ||
|
||
|
|
||
| [testenv:lint] | ||
| skip_install = True | ||
| deps = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.