openedx/repo-tools

script failed with trailing comma in a field

awais786 opened this issue · 0 comments

At the end there is a trailing comma and script failed on it.

models.OneToOneField('ArticleRevision',verbose_name=_(u'current revision'),blank=True, null=True, related_name='current_set' ,)
Here is a complete traceback
-    current_revision = models.OneToOneField('ArticleRevision',verbose_name=_(u'current revision'),blank=True, null=True, related_name='current_set',)
+    current_revision = models.OneToOneField('ArticleRevision',verbose_name=_(u'current revision'),blank=True, null=True, related_name='current_set',, on_delete=models.CASCADE)

     created = models.DateTimeField(auto_now_add=True, verbose_name=_(u'created'))
     modified = models.DateTimeField(auto_now=True, verbose_name=_(u'modified'),
ERR:tool.py:216  Bowler exception during transform of /Users/abc/Documents/devstack/django-wiki/wiki/plugins/attachments/models.py: Transforms generated invalid CST for /Users/abc/Documents/devstack/django-wiki/wiki/plugins/attachments/models.py
Traceback (most recent call last):
  File "/Users/abc/.virtualenvs/repo-toolspy37/lib/python3.7/site-packages/bowler/tool.py", line 145, in processed_file
    new_tree = self.driver.parse_string(new_text)
  File "/Users/abc/.virtualenvs/repo-toolspy37/lib/python3.7/site-packages/fissix/pgen2/driver.py", line 102, in parse_string
    return self.parse_tokens(tokens, debug)
  File "/Users/abc/.virtualenvs/repo-toolspy37/lib/python3.7/site-packages/fissix/pgen2/driver.py", line 71, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):
  File "/Users/abc/.virtualenvs/repo-toolspy37/lib/python3.7/site-packages/fissix/pgen2/parse.py", line 164, in addtoken
    raise ParseError("bad input", type, value, context)
fissix.pgen2.parse.ParseError: bad input: type=12, value=',', context=('', (24, 148))

The above exception was the direct cause of the following exception:

It adds double comma

+    current_revision = models.OneToOneField('ArticleRevision',verbose_name=_(u'current revision'),blank=True, null=True, related_name='current_set'
,, 
on_delete=models.CASCADE)