Skip to content

Commit 62ebf11

Browse files
committed
feat: comprehensive package enhancements and infrastructure
1 parent d0d3a21 commit 62ebf11

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

.github/workflows/dependency-scanning.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030
curl -sSL https://install.python-poetry.org | python3 -
3131
echo "$HOME/.local/bin" >> $GITHUB_PATH
3232
33+
- name: Install poetry export plugin
34+
run: |
35+
poetry self add poetry-plugin-export
36+
3337
- name: Install dependencies and export requirements
3438
run: |
3539
poetry install

src/my_python_package/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ def max_name_length(self) -> int:
107107
@max_name_length.setter
108108
def max_name_length(self, value: int) -> None:
109109
"""Set maximum name length."""
110-
if not isinstance(value, int) or value <= 0:
110+
if not isinstance(value, int):
111+
raise TypeError("Max name length must be an integer")
112+
if value <= 0:
111113
raise ValueError("Max name length must be a positive integer")
112114
self._config["max_name_length"] = value
113115

src/my_python_package/core.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,19 @@ def format_greeting(
208208
if uppercase:
209209
result = result.upper()
210210

211-
# Apply truncation if needed - fix the logic here
212-
if max_length and len(result) > max_length:
211+
# Apply truncation if needed - ensure we include part of the name
212+
if max_length is not None and len(result) > max_length:
213213
if max_length <= 3:
214214
result = "..."
215215
else:
216-
result = result[:max_length - 3] + "..."
216+
# Make sure we get some of the name in there
217+
# Format: "greeting, na..."
218+
greeting_part = f"{greeting}, "
219+
available_for_name = max_length - len(greeting_part) - 3 # 3 for "..."
220+
if available_for_name > 0:
221+
result = greeting_part + name[:available_for_name] + "..."
222+
else:
223+
result = result[:max_length - 3] + "..."
217224

218225
return result
219226

0 commit comments

Comments
 (0)