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

Add an ignored columns option #103

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

pymenguy
Copy link

@pymenguy pymenguy commented Nov 7, 2024

In the table output, there are many columns which clutter the output and reduce readability.

This command-line option offer the possibility to the user to remove undesirable columns, using the same format as the ignored-packages option.

Existing tests are still passing, however I am unsure how to add new cases as the output formatter is created only once at the setup phase.

Maybe a second CreateUut function with the ignored columns builtin, (and the same validations files for Json output, as it is not affected) or specific test functions in the TableOutputFormatterTest.cs instead of TestBase.cs

@sensslen sensslen self-requested a review November 7, 2024 15:46
Copy link
Owner

@sensslen sensslen left a comment

Choose a reason for hiding this comment

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

I'd really love to see this feature unit tested as well. Also I'm not sure it's wise to only implement this feature in the tabular output only. Also I'm not a big fan of using magic strings here. Would it be feasible to create an enum or something similar (a source generator would be an ideal fit for this) to make sure only the information available can be specified for exclusion.....

Copy link

sonarcloud bot commented Nov 8, 2024

@pymenguy
Copy link
Author

pymenguy commented Nov 8, 2024

I added an enum to match columns name to a common descriptor, and a proof of concept for the Json output.

Also, I've added tests results when removing columns, I didn't had the time to make it for all options in the enumeration.
A separate test case is written for the case where all columns are removed, which would crash the TablePrinter later in execution. I've simply added an exception with a more explicit message, and the test checks if it is raised.

I've not created the pull request yet, but I had a Markdown OutputType in the works, which would use this feature as well. (basically a subclass of TableOutputFormatter / TablePrinter)

@sensslen
Copy link
Owner

I created a PR on your repository with my suggested changes

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