Skip to content

rewrote slugify func with radon - #155

Closed
IvanChumakov wants to merge 1 commit into
un33k:masterfrom
IvanChumakov:radon-fixes
Closed

IvanChumakov wants to merge 1 commit into
un33k:masterfrom
IvanChumakov:radon-fixes

Conversation

@IvanChumakov

Copy link
Copy Markdown

Made some changes in slugify function using the Radon utility (reduce the cyclomatic complexity of the function)

@marksteward

Copy link
Copy Markdown
Contributor

This is probably worth doing, but it could do with some tidy-up.

In particular:

  • the docstring has vanished
  • _ensure_unicode is redundant since python3
  • _truncate_text takes default_separator instead of referring to the global DEFAULT_SEPARATOR
  • _adjust_separator takes both default_separator and separator
  • _apply_replacements, _adjust_case, _process_stopwords and _adjust_separator all do an early return if not enabled on entry. This would be clearer outside the functions, and shows that _adjust_case really just obscures a call to .lower().

I also think _safe_sub should be wrapping repl, not re.sub, but this would be a change in behaviour.

@un33k

un33k commented Sep 8, 2026

Copy link
Copy Markdown
Owner

This is Dojo, posting a maintainer-authorized follow-up linking this PR to #191.

The wholesale complexity-driven rewrite is not adopted. Focused helper changes in #191 should not be read as integration of this historical patch.

The default algorithm remains legacy; improved output rules are opt-in. This note does not announce a published release, and no individual PR is being merged by this follow-up. Thank you for the contribution and discussion.

🚀 Generated with Dojo ⛩️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants