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

Adds ability to ignore parse exception console messages #65

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

Conversation

dambrosio
Copy link

Allows a user to specify the doxyfile_ignore_parse_exceptions=True configuration value in the Sphinx conf.py file to prevent doxylink tag parsing from printing messages to console.

I.e.

Skipping function transform::invR(transform_pb2.Rotation2f a). Error reported from parser was: Expected ')', found '.'  (at char 14), (line:1, col:15)

These parsing messages can overwhelm the console and mask users from seeing valuable error or warning messages provided by Sphinx

@JasperCraeghs JasperCraeghs self-requested a review February 6, 2025 14:45
Copy link
Collaborator

@JasperCraeghs JasperCraeghs left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution. Instead of a boolean, we could support a list of regular expressions instead, for added granularity. What do you think?

This project has received contributions that we recently merged to the master branch but have not yet been released. These contributions will likely get rid of many of the parser warnings tnat you encounter. I will try to reach out to the owner of this repository again to make a release.

DOXYLINK_KEY = 'doxylink'

DOXYLINK_IGNORE_PARSE_EXCEPTIONS_KEY = (
'_'.join([DOXYLINK_KEY,'ignore_parse_exceptions'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
'_'.join([DOXYLINK_KEY,'ignore_parse_exceptions'])
'_'.join([DOXYLINK_KEY, 'ignore_parse_exceptions'])

Copy link
Author

Choose a reason for hiding this comment

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

That is my bad. Do we have a default linter/formatter for Python in this repo, to minimize these lint issues?

@@ -303,6 +306,10 @@ def join(*args):


def create_role(app, tag_filename, rootdir, cache_name, pdf=""):
ignore_parse_exceptions = getattr(app.config, config.DOXYLINK_IGNORE_PARSE_EXCEPTIONS_KEY)
if ignore_parse_exceptions:
report_info(app.env,"Ignoring parsing exceptions")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
report_info(app.env,"Ignoring parsing exceptions")
report_info(app.env, "Ignoring parsing exceptions")

@JasperCraeghs
Copy link
Collaborator

FYI We have released version 1.12.4 this evening.

I triggered the unit tests in CI and some of them require an update. If you want any help, let me know. 🙂

@dambrosio
Copy link
Author

FYI We have released version 1.12.4 this evening.

I triggered the unit tests in CI and some of them require an update. If you want any help, let me know. 🙂

I can test this out to see if it fixes some of the parse exceptions in our code base.

@dambrosio
Copy link
Author

Thanks for this contribution. Instead of a boolean, we could support a list of regular expressions instead, for added granularity. What do you think?

I would be down to change this behavior. Are you thinking a single regex or multiple regexs? Would the idea be to match specific text inside of the ParseException error message?

ie.

Skipping function company::DEFINE_string(logs_directory, "", "Path to the directory."). Error reported from parser was: Expected ')', found ','  (at char 15), (line:1, col:16)

So we could add a regex that would be something like company::DEFINE to only match specific member_kind, member_symbol or arglist values?

@dambrosio
Copy link
Author

FYI We have released version 1.12.4 this evening.
I triggered the unit tests in CI and some of them require an update. If you want any help, let me know. 🙂

I can test this out to see if it fixes some of the parse exceptions in our code base.

I still see parse exceptions in our code base. I think some are probably due to our usage of gflags as well as selectively including specific source for documentation. In either case, I still think having a mechanism to disable these prints would be helpful from our end.

@dambrosio dambrosio force-pushed the 55-ignore-parse-exception-print branch from d7f822b to 6a1d432 Compare February 7, 2025 18:10
@dambrosio
Copy link
Author

dambrosio commented Feb 7, 2025

@JasperCraeghs I updated with the regex approach. Here are my local repo test results:

Default for doxylink_parse_exception_ignore_regex_list

Skipping function company::DEFINE_bool(show, false, "Enable visualization"). Error reported from parser was: Expected ')', found ','  (at char 12), (line:1, col:13)
...
Skipping function company::anonymous_namespace{builder.cc}::kRange3D(8.f, 8.f, 3.f). Error reported from parser was: Expected ')', found '.'  (at char 2), (line:1, col:3)
...
Skipping function transform::getAngle(transform_pb2.Rotation2f rot). Error reported from parser was: Expected ')', found '.'  (at char 14), (line:1, col:15)
...

With the following doxylink_parse_exception_ignore_regex_list = [r".*DEFINE.*", r".*anonymous_namespace.*"]

Ignoring parsing exceptions using `re.compile('.*DEFINE.*|.*anonymous_namespace.*')`
...
Skipping function transform::getAngle(transform_pb2.Rotation2f rot). Error reported from parser was: Expected ')', found '.'  (at char 14), (line:1, col:15)
...

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