Skip to content
Merged
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
12 changes: 9 additions & 3 deletions check50/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,15 @@ def normalize(obj):
i = index
break

# center around diff
start = max(i - (config.truncate_len // 2), 0)
end = min(start + config.truncate_len, len(s))
# If the diff is within the first config.truncate_len characters,
# start from the beginning (no need for "..." at the start)
if i < config.truncate_len:
start = 0
end = min(config.truncate_len, len(s))
else:
# center around diff for differences further into the string
start = max(i - (config.truncate_len // 2), 0)
end = min(start + config.truncate_len, len(s))

snippet = s[start:end]

Expand Down
2 changes: 1 addition & 1 deletion check50/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Config:
"""

def __init__(self):
self.truncate_len = 10
self.truncate_len = 30
self.dynamic_truncate = True

# Create boolean validators for your variables here (if needed):
Expand Down