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 support to fail on warnings #7

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

Conversation

SteffenSeckler
Copy link

Adds support to fail on warnings.
These warnings can be filtered by a regex using grep.
Filtered and remaining warnings will be printed and the step will be set as failing iff no un-filtered warnings remain.

This adds the options

  fail-on-warnings:
    description: 'Make this action fail if doxygen produces warnings.'
    required: false
    default: false
  warnings-filter:
    description: 'Warning filter, matching lines will be filtered out.'
    required: false
    default: ''

The old behavior is kept and failure on warnings is only enabled if fail-on-warnings is set to true.

If fail-on-warnings is set to 'TRUE' and doxygen produces warnings, this step will fail. Default is 'FALSE'
@mattnotmitt
Copy link
Owner

Hey @SteffenSeckler, sorry that I haven't got around to this yet - been awfully busy at work and totally forgot about this. I'll try to review it sometime this week.

@mattnotmitt mattnotmitt force-pushed the feature/support_fail_on_warnings branch from 4f7a5e5 to 3063fbb Compare January 8, 2021 13:12
@mattnotmitt mattnotmitt force-pushed the feature/support_fail_on_warnings branch from e8aa764 to a230029 Compare January 8, 2021 13:20
@mattnotmitt
Copy link
Owner

@SteffenSeckler Ok, finally got around to looking at this PR. I've pushed some changes to your branch with some changes to config. I've noticed an issue when testing on my repo here: mattnotmitt/DelaunayTriangulation (note: seriously recommend nektos/act for testing). It seems that the filter can't handle the relatively common multiline warnings as seen in this build. Have you got any thoughts on how this could be fixed? Apart from that, love the solution 👍

@mattnotmitt mattnotmitt self-requested a review January 8, 2021 13:51

# if $5 is non-empty, apply filter.
if [ ! -z "$5" ]; then
grep "$5" warnings.txt > filtered-out-warnings.txt
Copy link
Owner

Choose a reason for hiding this comment

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

Could you look into a way in which we can filter out multiline warnings?

Copy link
Author

Choose a reason for hiding this comment

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

If I interpret the doxygen documentation correctly, there shouldn't really be multiline warnings.
And I assume that in multiple stages of the script... (e.g., using wc -l for the amount of warnings...).

Possibly, one could filter out that message, or, alternatively, remove the newline before such a message.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Owner

@mattnotmitt mattnotmitt Jan 11, 2021

Choose a reason for hiding this comment

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

Could we use WARN_LOGFILE as a command line option and then filter from that file? I've looked at doxygen's source and all warnings are prefixed with warning: so we can split based on that and then filter the resulting strings.

Copy link
Author

@SteffenSeckler SteffenSeckler Jan 11, 2021

Choose a reason for hiding this comment

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

  1. Using WARN_LOGFILE: Possible, but I assume it's the same result as using 2> warnings.txt.
  2. I also thought about using warning:. If someone provides a custom WARN_FORMAT, everything fails, anyways :) But using the default, It should work fine. One would lose the information from the next lines, though...

Copy link
Owner

Choose a reason for hiding this comment

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

Could use sed to pull the option out of the doxyfile like we do with the LaTeX option.

Choose a reason for hiding this comment

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

There can be multi line warnings in doxygen like:

cakephp-4.2.8/src/Collection/Iterator/FilterIterator.php:67: warning: no uniquely matching class member found for 
  Cake\Collection\Iterator\FilterIterator::unwrap()

or

mesa-21.1.5/src/gallium/frontends/clover/core/program.cpp:28: warning: no uniquely matching class member found for 
  program::program(clover::context &ctx, std::string &&source, clover::program::il_type il_type)
Possible candidates:
  'clover::program::program(clover::context &ctx, std::string &&il, enum il_type il_type)' at line 43 of file mesa-21.1.5/src/gallium/frontends/clover/core/program.hpp
  'clover::program::program(clover::context &ctx, const ref_vector< device > &devs={}, const std::vector< module > &binaries={})' at line 46 of file mesa-21.1.5/src/gallium/frontends/clover/core/program.hpp
  'clover::program::program(const program &prog)=delete' at line 50 of file mesa-21.1.5/src/gallium/frontends/clover/core/program.hpp

but there are more (some have even a return in them as in the input part there is a return).

Note that there is also the setting WARN_FORMAT it it is possible to insert. In the past I used:

 WARN_FORMAT = "#DOXY1#$file#DOXY2#$line#DOXY3#$text#DOXY4#"

so I could filter with awk.

Choose a reason for hiding this comment

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

Be aware of the fact that in the newer versions of doxygen (as of 1.9.0) there is the possibility FAIL_ON_WARNINGS with the setting WARN_AS_ERROR.:

WARN_AS_ERROR

If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when a warning
is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS then doxygen will continue
running as if WARN_AS_ERROR tag is set to NO, but at the end of the doxygen process doxygen will return
with a non-zero status.
Possible values are: NO, YES and FAIL_ON_WARNINGS.
The default value is: NO.

@Letme
Copy link

Letme commented Jun 21, 2021

How about we try to use https://pypi.org/project/mlx.warnings/ where we can set number of allowed warnings and only fail if it is outside of the range?

@natke
Copy link

natke commented Dec 8, 2021

You can also set Doxygen to fail on warnings in your Doxyfile: https://www.doxygen.nl/manual/config.html

Set the WARN_AS_ERROR flag to YES, NO, or FAIL_ON_WARNINGS

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.

5 participants