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

[BUG] --filter-by wrong section name throws exception #6024

Open
frextrite opened this issue Jun 10, 2019 · 2 comments
Open

[BUG] --filter-by wrong section name throws exception #6024

frextrite opened this issue Jun 10, 2019 · 2 comments

Comments

@frextrite
Copy link

Command Run

$ coala --json --filter-by some_unknown_filter_that_doesnt_exist

Output

[ERROR][14:47:33] An unknown error occurred. This is a bug. We are sorry for the inconvenience. Please contact the developers for assistance. During execution of coala an exception was raised. This should never happen. When asked for, the following information may help investigating:
[INFO][14:47:33] Exception was:
Traceback (most recent call last):

  File "/home/amol/GitHub/coala/coalib/coala_main.py", line 170, in run_coala
    filtered = apply_filters(filters, sections=all_sections)

  File "/home/amol/GitHub/coala/coalib/parsing/FilterHelper.py", line 81, in apply_filters
    items = applier(filter_name, filter_args, items)

  File "/home/amol/GitHub/coala/coalib/parsing/FilterHelper.py", line 101, in _apply_section_filter
    raise InvalidFilterException(filter_name)

coalib.parsing.InvalidFilterException.InvalidFilterException: 'some_unknown_filter_that_doesnt_exist' is an invalid filter. Available filters: can_detect, can_fix, language, section_tags


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/amol/GitHub/coala/coalib/coala_main.py", line 174, in run_coala
    console_printer.print(ex)

AttributeError: 'NoneType' object has no attribute 'print'

{
  "results": {}
}

Possible Solution

The proper error message must be shown indicating such a filter doesn't exist instead of throwing a raw error message.

InvalidFilterException exception is being correctly emitted by the bear, just need to catch it and show an error message.

difficulty/low

@xurror
Copy link

xurror commented Jun 17, 2019

I'll like to work on this

@PrasanthChettri
Copy link

Hi can I work on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants