dadadel / pyment

Format and convert Python docstrings and generates patches
GNU General Public License v3.0
905 stars 62 forks source link

Raise block convertion #51

Closed MircoT closed 6 years ago

MircoT commented 6 years ago

Hi,

I don't know if it is a problem but when the program finds exceptions without description it crashes. Could be useful if the script warns the user about it or creates an empty string in that place because as it is the error is not explicative.

The error is the following:

Traceback (most recent call last): File "/usr/local/bin/pyment", line 11, in load_entry_point('Pyment==0.3.2', 'console_scripts', 'pyment')() File "build/bdist.macosx-10.12-x86_64/egg/pyment/pymentapp.py", line 150, in main File "build/bdist.macosx-10.12-x86_64/egg/pyment/pymentapp.py", line 99, in run File "build/bdist.macosx-10.12-x86_64/egg/pyment/pyment.py", line 344, in proceed File "build/bdist.macosx-10.12-x86_64/egg/pyment/docstring.py", line 1960, in generate_docs File "build/bdist.macosx-10.12-x86_64/egg/pyment/docstring.py", line 1937, in _set_raw File "build/bdist.macosx-10.12-x86_64/egg/pyment/docstring.py", line 1822, in _set_raw_raise TypeError: cannot concatenate 'str' and 'NoneType' objects

I'm using Python 2.7.14 on MacOS with Pyment v0.3.2 and I was converting from Google doc style to reST.

To reproduce the problem you can use the following code:

def foo():
    """Bar bar bar.

    Raises:
        test
    """
    pass

As you can see if test has no description the program doesn't work, you have to specify something as follow.

def foo():
    """Bar bar bar.

    Raises:
        test: bar
    """
    pass
dadadel commented 6 years ago

Fixed by PR #66