bitprophet / releases

A powerful Sphinx changelog-generating extension.
http://releases.readthedocs.io/
BSD 2-Clause "Simplified" License
176 stars 41 forks source link

Configuration options should be optional #56

Closed AndreLouisCaron closed 8 years ago

AndreLouisCaron commented 8 years ago

If I only use the "-" or "0" options in my project, and don't configure the releases_issue_uri and releases_release_uri options in my conf.py file, I get the following stack trace:

Exception occurred:
  File "...\.tox\docs\lib\site-packages\releases\__init__.py", line 129, in release_nodes
    link = '<a class="reference external" href="{0}">{1}</a>'.format(uri, text)
UnboundLocalError: local variable 'uri' referenced before assignment

This is not super user friendly. If the options are required (looks like it from the docs), shouldn't we try to enforce the presence?

Also, since it's possible not to use these at all, can we make it optional? I understand that if someone uses the issue numbers but doesn't set the options, then maybe we'd want a warning or something, but crashing like this is probably not what you had in mind.

I'm willing to send in a patch if you're interested. Just let me know what you want as the final behavior.

bitprophet commented 8 years ago

This sounds like an edge case (until now, I can't say I have seen changelogs consisting 100% of non-numbered issues, they're usually mixed in with actual numbered issues) but one that I think should probably be legitimized. Certainly anything resulting in a traceback that doesn't have a human-facing error message, is bad, yup :) thanks for the report!

bitprophet commented 8 years ago

Also, regardless of whether you submit a patch, I'd love to see a copy of the changelog in question, makes recreating it locally easier.

AndreLouisCaron commented 8 years ago

Thanks for fixing this! Will be testing the next release :-)

bitprophet commented 8 years ago

Whoops, forgot to leave an explicit comment here (though you obviously saw the commit-driven stuff :)). So yea. Both of "your" recent issues are out now on PyPI in the 1.2.1 release. Hope they work for you! If not, let me know.

AndreLouisCaron commented 8 years ago

Neat thanks, I'll check it out!

AndreLouisCaron commented 8 years ago

Just tried this today on a new library, works like a charm, thanks!