Docstring Recipe generates git diff

I used the “Generate Docstrings” option on a class. The Sourcery pane took some time to load, but when it finally did, it generated this diff instead of just the docstring:

```
<<<<<<< SEARCH

class CreateGuide(PermissionRequiredMixin, CreateView):

model = models.Guide

template_name = "guides/create_guide.html"

form_class = forms.GuideForm

permission_required = "clients.add_guide"

raise_exception = True

def form_valid(self, form):

self.object = form.save()

return HttpResponseRedirect(reverse_lazy("guides_manage", kwargs=self.kwargs)+"?system_id="+str(self.object.system.id))

def get_context_data(self, **kwargs):

context = super().get_context_data(**kwargs)

context["guides_url"] = reverse_lazy("guides_manage", kwargs=self.kwargs)

return context

=======

class CreateGuide(PermissionRequiredMixin, CreateView):

"""Create a new guide.

This view handles the creation of new guides,

allowing users to add guides to the system.

"""

model = models.Guide

template_name = "guides/create_guide.html"

form_class = forms.GuideForm

permission_required = "clients.add_guide"

raise_exception = True

def form_valid(self, form):

self.object = form.save()

return HttpResponseRedirect(reverse_lazy("guides_manage", kwargs=self.kwargs)+"?system_id="+str(self.object.system.id))

def get_context_data(self, **kwargs):

context = super().get_context_data(**kwargs)

context["guides_url"] = reverse_lazy("guides_manage", kwargs=self.kwargs)

return context

>>>>>>> REPLACE
```

Usually, it just generates the class with the added docstring, and I can use the ‘insert at cursor’ option to just replace the code.

This would appear to be a bug to me. Does anyone else get this?

I’m on Windows 11, VS Code 1.99.3, Sourcery 1.35.0. Let me know if there’s any other diagnostic info I can provide.

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
📥

Feedback

Date

10 months ago

Author

James Walters

Subscribe to post

Get notified by email when there are changes.