Skip to content

Commit 048f66a

Browse files
authored
[CI] Update documentation check (#737)
* CI check documentation * update docs * prevent extra diff in code style
1 parent b46e3d3 commit 048f66a

File tree

3 files changed

+49
-26
lines changed

3 files changed

+49
-26
lines changed

.github/workflows/check.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,22 @@ jobs:
4848
run: |
4949
n=0
5050
for f in $(find . -type f -not -wholename '*/.*' -a -not -wholename '*/tests/samples/*' -a -not -wholename '*/corpus/*' -a -not -wholename '*.json'); do
51-
n=$(( 1 + ${n} ))
52-
filetype=$(file ${f})
53-
if echo "${filetype}" | grep -q '.*text.*'; then
54-
echo "CHECK:'${filetype}'"
55-
lastbyte=$(hexdump -v -e '/1 "%02X\n"' ${f} | tail -1)
56-
echo "Last byte is '${lastbyte}'"
57-
if [ "0A" != "${lastbyte}" ]; then
58-
echo "File ${f} has inappropriate line ending"
59-
tail -1 ${f} | hexdump -C
60-
else
61-
n=$(( ${n} - 1 ))
62-
fi
51+
n=$(( 1 + ${n} ))
52+
filetype=$(file ${f})
53+
if echo "${filetype}" | grep -q '.*text.*'; then
54+
echo "CHECK:'${filetype}'"
55+
lastbyte=$(hexdump -v -e '/1 "%02X\n"' ${f} | tail -1)
56+
echo "Last byte is '${lastbyte}'"
57+
if [ "0A" != "${lastbyte}" ]; then
58+
echo "File ${f} has inappropriate line ending"
59+
tail -1 ${f} | hexdump -C
6360
else
64-
echo "SKIP:'${filetype}'"
65-
n=$(( ${n} - 1 ))
61+
n=$(( ${n} - 1 ))
6662
fi
63+
else
64+
echo "SKIP:'${filetype}'"
65+
n=$(( ${n} - 1 ))
66+
fi
6767
done
6868
exit ${n}
6969
@@ -128,8 +128,15 @@ jobs:
128128
cd docs
129129
pip install --requirement requirements.txt
130130
make html
131-
cd source
132-
python -m sphinx -T -E -b html -d _build/doctrees -D language=en . ./_html
131+
python -m sphinx -T -E -b html -d _build/doctrees -D language=en ./source/ ./_html
132+
sphinx-apidoc --force --full --ext-autodoc ../credsweeper -o source/
133+
git checkout source/conf.py source/index.rst source/credsweeper.rst
134+
if [ 0 -ne $(git ls-files -m | wc -l) ]; then
135+
git diff
136+
echo "The documentation should be updated"
137+
git checkout .
138+
exit 1
139+
fi
133140
134141
# # # flake8
135142

@@ -139,9 +146,9 @@ jobs:
139146
run: |
140147
ERRCNT=$(flake8 credsweeper --count --exit-zero --output-file=flake8.txt)
141148
if ! [ 0 -eq ${ERRCNT} ] ; then
142-
echo "flake8 found '${ERRCNT}' failures:"
143-
cat flake8.txt
144-
exit 1
149+
echo "flake8 found '${ERRCNT}' failures:"
150+
cat flake8.txt
151+
exit 1
145152
fi
146153
147154
- name: FLAKE 8 reports
@@ -164,17 +171,17 @@ jobs:
164171
run: |
165172
crc32_int=0
166173
for f in $(find credsweeper -iregex '.*\.\(py\|json\|yaml\|txt\|onnx\)$'); do
167-
file_crc32_hex=$(crc32 $f)
168-
file_crc32_int=$((16#${file_crc32_hex}))
169-
crc32_int=$(( ${crc32_int} ^ ${file_crc32_int} ))
170-
done
174+
file_crc32_hex=$(crc32 $f)
175+
file_crc32_int=$((16#${file_crc32_hex}))
176+
crc32_int=$(( ${crc32_int} ^ ${file_crc32_int} ))
177+
done
171178
version_with_crc="$(python -m credsweeper --version | head -1) crc32:$(printf '%x' ${crc32_int})"
172179
echo "version_with_crc = '${version_with_crc}'"
173180
banner=$(python -m credsweeper --banner | head -1)
174181
echo "banner = '${banner}'"
175182
if ! [ -n "${version_with_crc}" ] && [ -n "${banner}" ] && [ "${version_with_crc}" == "${banner}" ]; then
176-
echo "'${version_with_crc}' != '${banner}'"
177-
exit 1
183+
echo "'${version_with_crc}' != '${banner}'"
184+
exit 1
178185
fi
179186
180187
# # # yapf
@@ -183,7 +190,7 @@ jobs:
183190
if: ${{ always() && steps.setup_credsweeper.conclusion == 'success' }}
184191
run: |
185192
for f in credsweeper tests docs experiment; do
186-
yapf --style .style.yapf --recursive --in-place --parallel $f
193+
yapf --style .style.yapf --recursive --in-place --parallel $f
187194
done
188195
if [ 0 -ne $(git ls-files -m | wc -l) ]; then
189196
git diff

docs/source/credsweeper.deep_scanner.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ credsweeper.deep\_scanner.rpm\_scanner module
164164
:undoc-members:
165165
:show-inheritance:
166166

167+
credsweeper.deep\_scanner.sqlite3\_scanner module
168+
-------------------------------------------------
169+
170+
.. automodule:: credsweeper.deep_scanner.sqlite3_scanner
171+
:members:
172+
:undoc-members:
173+
:show-inheritance:
174+
167175
credsweeper.deep\_scanner.tar\_scanner module
168176
---------------------------------------------
169177

docs/source/credsweeper.filters.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ credsweeper.filters.value\_jfrog\_token\_check module
244244
:undoc-members:
245245
:show-inheritance:
246246

247+
credsweeper.filters.value\_json\_web\_key\_check module
248+
-------------------------------------------------------
249+
250+
.. automodule:: credsweeper.filters.value_json_web_key_check
251+
:members:
252+
:undoc-members:
253+
:show-inheritance:
254+
247255
credsweeper.filters.value\_json\_web\_token\_check module
248256
---------------------------------------------------------
249257

0 commit comments

Comments
 (0)