Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Prospector checker initial commit (#20684)
Browse files Browse the repository at this point in the history
  • Loading branch information
mozga-intel authored Oct 30, 2021
1 parent 3b48957 commit 79e1753
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 470 deletions.
10 changes: 8 additions & 2 deletions ci/docker/install/requirements
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Cython==0.29.24

# Development dependencies
cpplint==1.3.0
pylint==2.3.1 # pylint and astroid need to be aligned
astroid==2.3.3 # pylint and astroid need to be aligned
pylint<3,>=2.8.3 # pylint and astroid need to be aligned
astroid<2.9,>=2.8.0 # pylint and astroid need to be aligned
pytest==6.1.2
pytest-env==0.6.2
pytest-cov==2.10.1
Expand All @@ -54,3 +54,9 @@ h5py==2.10.0

# Array API Standardization requirements
hypothesis==6.14.0

# Prospector - Python Static Analysis
prospector==1.5.1

# pyflakes - passive checker of Python programs
pyflakes<2.4.0,>=2.2.0
31 changes: 23 additions & 8 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,17 @@ sanity_check() {
set -ex
sanity_clang
sanity_license
sanity_python
sanity_tutorial
sanity_python_prospector
sanity_cpp
}

sanity_tutorial() {
set -ex
export DMLC_LOG_STACK_TRACE_DEPTH=100
OMP_NUM_THREADS=$(expr $(nproc) / 4) pytest -n 4 tests/tutorials/test_sanity_tutorials.py
}

sanity_license() {
set -ex
tools/license_header.py check
Expand All @@ -717,6 +724,21 @@ sanity_cpp() {
3rdparty/dmlc-core/scripts/lint.py mxnet cpp include src plugin cpp-package tests --exclude_path src/operator/contrib/ctc_include include/onednn
}

sanity_python_prospector() {
set -e
set +x

# Run Prospector
python3 -m prospector --profile prospector.yaml | tee prospector-output.txt
error_cnt=$(awk '/Messages Found:/{print $NF}' prospector-output.txt)
if [ $error_cnt -ne 0 ]; then
echo 'Please fix the above Prospector warnings.'
rm -rf prospector-output.txt
exit 1
fi
rm -rf prospector-output.txt
}

sanity_clang() {
set -e
set +x
Expand Down Expand Up @@ -755,13 +777,6 @@ sanity_clang() {
exit 1
}

sanity_python() {
set -ex
export DMLC_LOG_STACK_TRACE_DEPTH=100
python3 -m pylint --rcfile=ci/other/pylintrc --ignore-patterns=".*\.so$$,.*\.dll$$,.*\.dylib$$" python/mxnet
OMP_NUM_THREADS=$(expr $(nproc) / 4) pytest -n 4 tests/tutorials/test_sanity_tutorials.py
}

# Tests libmxnet
# Parameters:
# $1 -> mxnet_variant: The variant of the libmxnet.so library
Expand Down
Loading

0 comments on commit 79e1753

Please sign in to comment.