-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support replacing call to url
with simple patterns by path
#138
Conversation
Codecov Report
@@ Coverage Diff @@
## master #138 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 19 +2
Lines 455 548 +93
=========================================
+ Hits 455 548 +93
Continue to review full report at Codecov.
|
# Conflicts: # django_codemod/visitors/urls.py
# Conflicts: # django_codemod/visitors/base.py
Sourcery Code Quality Report (beta)Merging this PR leaves code quality unchanged.
Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! |
url()
with simple patterns by path()
url
with simple patterns by path
Currently we replace
url()
byre_path()
which is a simple rename operation. We could go one step further by looking at the URL pattern and replace the simple ones by thepath()
function from Django 2.0 which is less error prone.The most basic would be to check whether the RegEx has any captured groups in it and if not, we can assume the replacement is simple.
We could later consider improving this by trying to convert URLs with only simple captured groups (
slug
,int
, etc...).