spadarian / docblock-python

Atom plugin to insert documentation blocks for python functions
GNU General Public License v2.0
22 stars 9 forks source link

Uncaught TypeError: Cannot read property '1' of null #52

Open dtoniolo opened 3 years ago

dtoniolo commented 3 years ago

Steps to Reproduce:

  1. Creating a dock block on a class with empty (incomplete) __init__ generates the error. Write the following code:
    class foo():
    def __init__(self, bah)
  2. Generate doc-block (e.g. by selecting the class name, right clicking and then executing Generate DocBlock)

Adding a colon and a pass statement makes it execute correctly.

class foo():
    """Short summary."""
    def __init__(self, bah):
        pass

Atom: 1.54.0 x64 Electron: 6.1.12 OS: Mac OS X 10.15.7 Thrown From: docblock-python package 0.19.1

Stack Trace

Uncaught TypeError: Cannot read property '1' of null

At ~/.atom/packages/docblock-python/lib/docblock-python.js:730

TypeError: Cannot read property '1' of null
    at Object.process_class (/packages/docblock-python/lib/docblock-python.js:730:30)
    at /packages/docblock-python/lib/docblock-python.js:360:29
    at Array.map (<anonymous>)
    at /packages/docblock-python/lib/docblock-python.js:331:12
    at Object.generate_docblock (/packages/docblock-python/lib/docblock-python.js:395:10)
    at HTMLElement.docblockPythonGenerate_docblock (/packages/docblock-python/lib/docblock-python.js:163:53)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:350382)
    at CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:348857)
    at AtomEnvironment.dispatchContextMenuCommand (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:727628)
    at EventEmitter.t (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:735661)
    at EventEmitter.emit (events.js:200:13)
    at Object.onMessage (/Applications/Atom.app/Contents/Resources/electron.asar/renderer/init.js:42:16)

Commands

     -0:44.2.0 markdown-writer:indent-list-line (input.hidden-input)
     -0:44.2.0 snippets:next-tab-stop (input.hidden-input)
     -0:44.2.0 snippets:expand (input.hidden-input)
     -0:44.2.0 editor:indent (input.hidden-input)
     -0:44 markdown-writer:indent-list-line (input.hidden-input)
     -0:44 snippets:next-tab-stop (input.hidden-input)
     -0:44 snippets:expand (input.hidden-input)
     -0:44 editor:indent (input.hidden-input)
     -0:43.8.0 markdown-writer:indent-list-line (input.hidden-input)
     -0:43.8.0 snippets:next-tab-stop (input.hidden-input)
     -0:43.8.0 snippets:expand (input.hidden-input)
     -0:43.8.0 editor:indent (input.hidden-input)
     -0:40.6.0 editor:delete-to-beginning-of-line (input.hidden-input)
     -0:40.4.0 core:backspace (input.hidden-input)
  2x -0:35.2.0 docblock-python:generate_docblock (span.syntax--source.syntax--python)
     -0:02.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)

Non-Core Packages

autocomplete-python 1.17.0 
busy-signal 2.0.1 
copy-as-rtf 0.9.3 
docblock-python 0.19.1 
file-icons 2.1.46 
Hydrogen 2.14.7 
intentions 1.1.5 
language-cypher 0.5.0 
language-latex 1.2.0 
linter 3.3.0 
linter-flake8 2.4.0 
linter-ui-default 3.2.3 
markdown-preview-plus 4.9.0 
markdown-themeable-pdf 1.2.1 
markdown-writer 2.11.11 
python-autopep8 0.1.3 
script 3.29.3 
split-diff 1.6.1