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

audit bug fix: handles short files better #48

Merged
merged 1 commit into from
Jul 3, 2018

Conversation

domanchi
Copy link
Contributor

@domanchi domanchi commented Jul 3, 2018

Our default lines_of_context when printing the interactive auditor is 5. However, when there isn't five lines to print, we can find ourselves in a strange case: the auditor doesn't know how to handle it so it either:

a) throws an IndexError exception (if abs(-lines_of_context -1 ) > len(output)), OR
b) displays a ERROR: Secret not found on specified line number!

So let's handle this better.

@domanchi domanchi requested a review from KevinHock July 3, 2018 16:37
Copy link
Collaborator

@KevinHock KevinHock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -441,15 +442,7 @@ def test_input_message(self, prompt_secret_decision, expected_output):

@pytest.fixture
def mock_printer():
Copy link
Collaborator

@KevinHock KevinHock Jul 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nit: Maybe consider renaming to avoid the name conflict/alias of the mock_printer
import, e.g. mock_audit_printer or something. (Makes grep'ing a little easier.)

BashColor.disable_color()

with mock_stdin(), mock_printer(
# To extract the baseline output
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great mock.patch comments!

@domanchi domanchi merged commit 1f86f89 into master Jul 3, 2018
@domanchi domanchi deleted the bug-fix-off-by-one-error branch July 3, 2018 18:10
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

Successfully merging this pull request may close these issues.

None yet

2 participants