Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division by zero in FortranBase.lines_description #160

Closed
aradi opened this issue Aug 3, 2016 · 9 comments
Closed

Division by zero in FortranBase.lines_description #160

aradi opened this issue Aug 3, 2016 · 9 comments

Comments

@aradi
Copy link

aradi commented Aug 3, 2016

Under certain conditions, FortranBase.line_description gots 0 for the variable total which leads to division by zero. See pull request #159 for a possible fix.

@cmacmackin
Copy link
Contributor

I think I'll make the fix a bit more sophisticated, so that you don't just get an empty popup. But what are the conditions under which total == 0? I'd have thought that could only arise due to a bug somewhere else in FORD.

@aradi
Copy link
Author

aradi commented Aug 3, 2016

I've sent you by mail the project I tried to document. It may be some misconfiguration of Ford by me as well. As for the fix, mine was definitely more a hack than a fix, so I am glad, you come up with something more meaningful 😄

@cmacmackin
Copy link
Contributor

Thanks. I'll try to get to this over the weekend.

On 03/08/16 19:11, Bálint Aradi wrote:

I've sent you by mail the project I tried to document. It may be some
misconfiguration of Ford by me as well. As for the fix, mine was
definitely more a hack than a fix, so I am glad, you come up with
something more meaningful 😄


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/cmacmackin/ford/issues/160#issuecomment-237319058,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHxJPZH39JIePoOeMSNZbOI-TIXAN1aGks5qcNnXgaJpZM4Jbutt.

Chris MacMackin
cmacmackin.github.io https://cmacmackin.github.io

@ilovezfs
Copy link

ilovezfs commented Sep 5, 2016

@cmacmackin any progress on this? It's blocking Homebrew/homebrew-core#3897, which offers a reproducible test case if you need one. The stack looks like this:

-- Dynamically computing FORD output information...
-- Running FORD to dynamically compute documentation outputs, this could take a while...
Traceback (most recent call last):
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/lib/python2.7/site-packages/ford/output.py", line 98, in __init__
    self.docs.append(FilePage(data,project,item))
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/lib/python2.7/site-packages/ford/output.py", line 201, in __init__
    self.html = self.render(data,proj,obj)
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/lib/python2.7/site-packages/ford/output.py", line 326, in render
    return template.render(data,src=obj,project=proj)
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/vendor/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/vendor/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/lib/python2.7/site-packages/ford/templates/file_page.html", line 1, in top-level template code
    {% extends "base.html" %}s
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/lib/python2.7/site-packages/ford/templates/base.html", line 138, in top-level template code
    {% block body %}
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/lib/python2.7/site-packages/ford/templates/file_page.html", line 12, in block "body"
    {{ macros.info_bar(src.name,src.meta,project_url,src.hierarchy,src.lines_description(project.file_lines)) }}
  File "/usr/local/Cellar/ford/5.0.4-he/libexec/lib/python2.7/site-packages/ford/sourceform.py", line 231, in lines_description
    description = "{:4.1f}% of total for {}.".format(float(self.num_lines)/total*100,pretty_obj[obj])
ZeroDivisionError: float division by zero
Error encountered.

@cmacmackin
Copy link
Contributor

Hi, sorry about the delay. I've been busy on other projects. I'll try to get to this in the next week.

@cmacmackin
Copy link
Contributor

Fixed and will be in the next release, out today or tomorrow.

@cmacmackin
Copy link
Contributor

Just authored a release fixing this.

@ilovezfs
Copy link

Cool. thanks!

@ilovezfs
Copy link

@cmacmackin Homebrew PR for your new version: Homebrew/homebrew-core#4848

thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants