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 the possibility to disable the individual warnings #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

vadz
Copy link
Collaborator

@vadz vadz commented Sep 28, 2014

I'm not happy with this, importing both warning and WARN is redundant, but I don't know how to avoid it. I'm also not sure if there is no some better way to selectively suppress and annotate the log messages, Python logging module is mind bogglingly complex and horribly documented, so I'm completely lost in it.

Please let me know if you can see how to do it better.

But at least this does seem to work...

I just realized that another possibility might be to use gcc-like approach and use warning names instead of numbers, e.g. -Wno-unused-vars instead of the current -w 102. Would you prefer to do it like this?

Also, I guess this needs to be documented, but the command line tool doesn't seem to be documented at all right now, or am I missing something?

This will allow to disable different warnings individually.
Also show the warning number associated with the warning when outputting it to
let the users know which warning do they need to disable if they don't want to
see some message.
@vslavik
Copy link
Owner

vslavik commented Oct 1, 2014

I'm not happy with this, importing both warning and WARN is redundant, but I don't know how to avoid it.

Having a class for scope is not very pythonic either. Why not use the warning function for the scope instead (e.g. warning.PATH_SEPARATOR) if you don't want to use the more common module scope? You can do that, see e.g. http://stackoverflow.com/questions/338101/python-function-attributes-uses-and-abuses

Python logging module is mind bogglingly complex and horribly documented, so I'm completely lost in it.

Agreed about logging. Why use it, though, instead of implementing the filtering in the error module and throw out the suppressed warnings right in error.warning()?

I just realized that another possibility might be to use gcc-like approach and use warning names instead of numbers, e.g. -Wno-unused-vars instead of the current -w 102. Would you prefer to do it like this?

Yes, I think it's the better approach — it makes the command line human-readable and makes it possible to enable warnings in a nice way too, should we decide to do that in the future. I'd also append [-Wunused-wars] style tag to the end of the warning message as GCC does, instead of warning %d.

but the command line tool doesn't seem to be documented at all right now, or am I missing something?

It's documented by means of the --help flag. There isn't currently much to add to what that output says...

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