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 pre-commit hook to validate doxygen #1334

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ repos:
# of dependencies, so we'll have to update this manually.
additional_dependencies:
- cmakelang==0.6.13
- id: doxygen-check
name: doxygen-check
entry: ./scripts/doxygen.sh
types_or: [file]
language: system
pass_filenames: false
verbose: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
Expand Down
3 changes: 2 additions & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ dependencies:
# pre-commit requires identify minimum version 1.0, but clang-format requires textproto support and that was
# added in 2.5.20, so we need to call out the minimum version needed for our plugins
- identify>=2.5.20
- &doxygen doxygen=1.8.20
cudatoolkit:
specific:
- output_types: conda
Expand Down Expand Up @@ -153,7 +154,7 @@ dependencies:
common:
- output_types: [conda]
packages:
- doxygen=1.8.20
- *doxygen
- graphviz
- ipython
- make
Expand Down
35 changes: 35 additions & 0 deletions scripts/doxygen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Copyright (c) 2023, NVIDIA CORPORATION.
##############################
# RMM doxygen warnings check #
##############################

# skip if doxygen is not installed
if ! [ -x "$(command -v doxygen)" ]; then
echo -e "warning: doxygen is not installed"
exit 0
fi

# Utility to return version as number for comparison
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }

# doxygen supported version 1.8.20 to 1.9.1
DOXYGEN_VERSION=`doxygen --version`
if [ $(version "$DOXYGEN_VERSION") -lt $(version "1.8.20") ] || [ $(version $DOXYGEN_VERSION) -gt $(version "1.9.1") ]; then
echo -e "warning: Unsupported doxygen version $DOXYGEN_VERSION"
echo -e "Expecting doxygen version from 1.8.20 to 1.9.1"
exit 0
fi

# Run doxygen, ignore missing tag files error
TAG_ERROR1="error: Tag file '.*.tag' does not exist or is not a file. Skipping it..."
TAG_ERROR2="error: cannot open tag file .*.tag for writing"
DOXYGEN_STDERR=`cd doxygen && { cat Doxyfile ; echo QUIET = YES; echo GENERATE_HTML = NO; } | doxygen - 2>&1 | sed "/\($TAG_ERROR1\|$TAG_ERROR2\)/d"`
RETVAL=$?

if [ "$RETVAL" != "0" ] || [ ! -z "$DOXYGEN_STDERR" ]; then
echo -e "$DOXYGEN_STDERR"
RETVAL=1 #because return value is not generated by doxygen 1.8.20
fi

exit $RETVAL