Skip to content

Commit

Permalink
Put filenames in incomplete group errors.
Browse files Browse the repository at this point in the history
When we fail to annotate a file because we finished reading the file
with an incomplete group, print the name of the file so that we can go
fix it.
  • Loading branch information
feanil authored and regisb committed Dec 4, 2020
1 parent 32370e1 commit 9323c95
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Change Log

.. There should always be an "Unreleased" section for changes pending release.
[0.10.2] - 2020-11-09
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Improve logging when we fail to process a file because it has an incomplete
annotation group.

[0.10.1] - 2020-11-09
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion code_annotations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Extensible tools for parsing annotations in codebases.
"""

__version__ = '0.10.1'
__version__ = '0.10.2'
2 changes: 1 addition & 1 deletion code_annotations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def check_results(self, all_results):
found_group_members = []

if current_group:
self.errors.append('File finished with an incomplete group {}!'.format(current_group))
self.errors.append('File("{}") finished with an incomplete group {}!'.format(filename, current_group))

return not self.errors

Expand Down
4 changes: 2 additions & 2 deletions tests/extensions/test_extension_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
('simple_success.js', EXIT_CODE_SUCCESS, 'Search found 26 annotations in'),
('group_ordering_1.js', EXIT_CODE_SUCCESS, 'Search found 3 annotations in'),
('group_ordering_2.js', EXIT_CODE_SUCCESS, 'Search found 9 annotations in'),
('group_failures_1.js', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
('group_failures_2.js', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
('group_failures_1.js', EXIT_CODE_FAILURE, 'File("group_failures_1.js") finished with an incomplete group'),
('group_failures_2.js', EXIT_CODE_FAILURE, 'File("group_failures_2.js") finished with an incomplete group'),
('group_failures_4.js', EXIT_CODE_FAILURE, '".. no_pii:" is not in the group that starts with'),
('group_failures_5.js', EXIT_CODE_FAILURE, '".. pii_types:" is already in the group that starts with'),
('choice_failures_1.js', EXIT_CODE_FAILURE, '"doesnotexist" is not a valid choice for ".. ignored:"'),
Expand Down
4 changes: 2 additions & 2 deletions tests/extensions/test_extension_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
('simple_success.pyt', EXIT_CODE_SUCCESS, 'Search found 20 annotations in'),
('group_ordering_1.pyt', EXIT_CODE_SUCCESS, 'Search found 3 annotations in'),
('group_ordering_2.pyt', EXIT_CODE_SUCCESS, 'Search found 9 annotations in'),
('group_failures_1.pyt', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
('group_failures_2.pyt', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
('group_failures_1.pyt', EXIT_CODE_FAILURE, 'File("group_failures_1.pyt") finished with an incomplete group'),
('group_failures_2.pyt', EXIT_CODE_FAILURE, 'File("group_failures_2.pyt") finished with an incomplete group'),
('choice_failures_1.pyt', EXIT_CODE_FAILURE, '"doesnotexist" is not a valid choice for ".. ignored:"'),
('choice_failures_2.pyt', EXIT_CODE_FAILURE, '"doesnotexist" is not a valid choice for ".. ignored:"'),
('choice_failures_3.pyt', EXIT_CODE_FAILURE, '"terrible|silly-silly" is not a valid choice for ".. ignored:"'),
Expand Down

0 comments on commit 9323c95

Please sign in to comment.