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

fix(command line): markdown_root url #2513

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions slither/utils/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,15 @@ def check_and_sanitize_markdown_root(markdown_root: str) -> str:

if not match.group(4):
logger.warning(
"Appending 'master/tree/' in markdown_root url for better code referencing"
"Appending 'tree/master/' in markdown_root url for better code referencing"
)
markdown_root = markdown_root + "master/tree/"
markdown_root = markdown_root + "tree/master/"
# Use blob/HEAD so that we get the default branch regardless of its name
elif match.group(4) == "tree":
logger.warning(
"Replacing 'tree' with 'blob' in markdown_root url for better code referencing"
"Replacing 'tree' with 'blob/HEAD' in markdown_root url for better code referencing"
)
positions = match.span(4)
markdown_root = f"{markdown_root[:positions[0]]}blob{markdown_root[positions[1]:]}"
markdown_root = f"{markdown_root[:positions[0]]}blob/HEAD{markdown_root[positions[1]:]}"

return markdown_root
Loading