Skip to content

Commit 9323c95

Browse files
feanilregisb
authored andcommitted
Put filenames in incomplete group errors.
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.
1 parent 32370e1 commit 9323c95

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ Change Log
1111

1212
.. There should always be an "Unreleased" section for changes pending release.
1313
14+
[0.10.2] - 2020-11-09
15+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
17+
* Improve logging when we fail to process a file because it has an incomplete
18+
annotation group.
19+
1420
[0.10.1] - 2020-11-09
1521
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1622

code_annotations/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Extensible tools for parsing annotations in codebases.
33
"""
44

5-
__version__ = '0.10.1'
5+
__version__ = '0.10.2'

code_annotations/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ def check_results(self, all_results):
480480
found_group_members = []
481481

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

485485
return not self.errors
486486

tests/extensions/test_extension_javascript.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
('simple_success.js', EXIT_CODE_SUCCESS, 'Search found 26 annotations in'),
1111
('group_ordering_1.js', EXIT_CODE_SUCCESS, 'Search found 3 annotations in'),
1212
('group_ordering_2.js', EXIT_CODE_SUCCESS, 'Search found 9 annotations in'),
13-
('group_failures_1.js', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
14-
('group_failures_2.js', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
13+
('group_failures_1.js', EXIT_CODE_FAILURE, 'File("group_failures_1.js") finished with an incomplete group'),
14+
('group_failures_2.js', EXIT_CODE_FAILURE, 'File("group_failures_2.js") finished with an incomplete group'),
1515
('group_failures_4.js', EXIT_CODE_FAILURE, '".. no_pii:" is not in the group that starts with'),
1616
('group_failures_5.js', EXIT_CODE_FAILURE, '".. pii_types:" is already in the group that starts with'),
1717
('choice_failures_1.js', EXIT_CODE_FAILURE, '"doesnotexist" is not a valid choice for ".. ignored:"'),

tests/extensions/test_extension_python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
('simple_success.pyt', EXIT_CODE_SUCCESS, 'Search found 20 annotations in'),
1414
('group_ordering_1.pyt', EXIT_CODE_SUCCESS, 'Search found 3 annotations in'),
1515
('group_ordering_2.pyt', EXIT_CODE_SUCCESS, 'Search found 9 annotations in'),
16-
('group_failures_1.pyt', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
17-
('group_failures_2.pyt', EXIT_CODE_FAILURE, 'File finished with an incomplete group'),
16+
('group_failures_1.pyt', EXIT_CODE_FAILURE, 'File("group_failures_1.pyt") finished with an incomplete group'),
17+
('group_failures_2.pyt', EXIT_CODE_FAILURE, 'File("group_failures_2.pyt") finished with an incomplete group'),
1818
('choice_failures_1.pyt', EXIT_CODE_FAILURE, '"doesnotexist" is not a valid choice for ".. ignored:"'),
1919
('choice_failures_2.pyt', EXIT_CODE_FAILURE, '"doesnotexist" is not a valid choice for ".. ignored:"'),
2020
('choice_failures_3.pyt', EXIT_CODE_FAILURE, '"terrible|silly-silly" is not a valid choice for ".. ignored:"'),

0 commit comments

Comments
 (0)