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

Output tweaks #172

Merged
merged 4 commits into from
Sep 7, 2018
Merged

Output tweaks #172

merged 4 commits into from
Sep 7, 2018

Conversation

bcaller
Copy link
Collaborator

@bcaller bcaller commented Sep 5, 2018

  • Adds --screen output for ANSI colour codes (not that colourful to be honest as I didn't want to go crazy)
  • Adds --only-unsanitised to not print santised vulnerabilities as they can confuse the output
  • Adds basic logging of what pyt is doing with -v, -vv or -vvv

pytvuln

vulns

@bcaller
Copy link
Collaborator Author

bcaller commented Sep 5, 2018

I just removed the underline from the sink in the images above as it obscures underscores. Otherwise it's the same.

Prints vulnerabilities with ANSI colour codes for the terminal.

Not crazily colourful: just tries to highlight the important stuff.

Repeated filenames aren't printed.
Colour scheme might not be to everyone's taste.
It is sometimes what you want, but often you just want the failures
without sanitised vulns in the output.
Very basic python logging added to pyt.

Very useful when you want to see:

-  which files are being processed
-  if your imports are not being inspected
-  which file crashed pyt
@KevinHock KevinHock self-requested a review September 5, 2018 19:50
@KevinHock
Copy link
Collaborator

This is lovely! ❤️ 😁 I'll have a look as soon as I can

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.

Looks great to me!

"""This formatter outputs the issues as color-coded text."""
from ..vulnerabilities.vulnerability_helper import SanitisedVulnerability, UnknownVulnerability

RESET = '\033[0m'
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️

@KevinHock KevinHock merged commit c7b244d into python-security:master Sep 7, 2018
@@ -64,6 +65,14 @@ def retrieve_nosec_lines(
def main(command_line_args=sys.argv[1:]): # noqa: C901
args = parse_args(command_line_args)

logging_level = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is one of the prettiest ways I've seen people set the logging level.

@bcaller bcaller deleted the formatter branch September 7, 2018 10:39
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.

2 participants