-
Notifications
You must be signed in to change notification settings - Fork 31
For #81 - fix undefined variable in get_type_by_name() #88
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
Conversation
Happy to review it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug fix looks good. Please see the inline comments and pylint
report below for the proposed changes.
- All tests pass.
- x-failing tests are unaffected by the current issue.
- Modified/added tests do not use nose.
pycodestyle
on added/modified code passes.pylint
ontest_block_stmts.py
is 10/10.- The interface to
get_type_by_name(self, name)
in modified classHasImplicitStmt(object)
is now documented. pylint
returns some warnings and errors for the modified class (below). I am aware not all of them are for the modified lines, however I think would be good to improve the code quality for the entire class.
C: 99, 0: Missing class docstring (missing-docstring)
C:101, 4: Invalid class attribute name "a" (invalid-name)
E:129,56: Instance of 'HasImplicitStmt' has no 'item' member (no-member)
E:132,53: Instance of 'HasImplicitStmt' has no 'item' member (no-member)
C:135, 4: Missing method docstring (missing-docstring)
C:140,12: Invalid variable name "c" (invalid-name)
C:140,15: Invalid variable name "t" (invalid-name)
C:143,12: Invalid variable name "st" (invalid-name)
C:150, 8: Invalid variable name "s" (invalid-name)
C:151, 8: Invalid variable name "ls" (invalid-name)
C:152,12: Invalid variable name "st" (invalid-name)
C:152,16: Invalid variable name "l" (invalid-name)
C:155, 8: Invalid variable name "s" (invalid-name)
- All modified/new code is covered, but not all of the existing code in
get_type_by_name(self, name)
(see inline comment). - Documentation builds correctly and it is up-to-date.
- Please bring the branch up-to-date before the next review if required.
src/fparser/one/block_statements.py
Outdated
Returns an object of the correct type (Integer or Real) using | ||
Fortran's implicit typing rules for the supplied variable name. | ||
:param str name: the variable name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps The variable name
as other descriptions are capitalised after :
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, done.
''' | ||
implicit_rules = self.a.implicit_rules | ||
if implicit_rules is None: | ||
raise AnalyzeError('Implicit rules mapping is null ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider adding tests to cover lines 116 and 120 so the entire function is covered. I am aware the missing coverage is not the result of this PR so this is up to the developer's good will :)
Codecov Report
@@ Coverage Diff @@
## master #88 +/- ##
==========================================
+ Coverage 88.73% 89.46% +0.72%
==========================================
Files 23 24 +1
Lines 10513 10575 +62
==========================================
+ Hits 9329 9461 +132
+ Misses 1184 1114 -70
Continue to review full report at Codecov.
|
I've updated for pylint as requested and added further tests to hit the missed lines. They then revealed a Python 3 problem which I have also fixed. |
I've rebased this branch onto the head of master. Ready for second review. |
(Forgot to say that I haven't updated the class attribute named "a" because, even though it's a rubbish name, it permeates a lot of the code. Something for a separate issue.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pylint
clean-up, updating tests and fixing Python 3 issue in typedecl_statements.py
. The last revealed some pycodestyle
cleanup is required there, but that can be left for another day.
Proceeding to merge.
Small code fix and added new test for the associated routine.