Skip to content

Commit afb147a

Browse files
Merge branch 'master' into dependabot/github_actions/dot-github/workflows/master/ossf/scorecard-action-6622d322b30ed8cdd77455e4af0bddb2b735325c
* master: : Master Branch [DEBUG] part n+8 of many debugging [DEBUG] part n+7 of many debugging - exit 0 to allow posing scan alerts [DEBUG] part n+6 of many debugging [DEBUG] part n+5 of many debugging [DEBUG] part n+4 of many debugging [DEBUG] part n+3 of many debugging [DEBUG] part n+2 of many debugging [PATCH] part n+1 of many debugging [UPDATE] version bump to latest checkmake bd26d7905e47713ff0bf3b0e5e7b9c55f0d24e53 Changes in file .github/tool_checkmake.sh: fi function check_command() { Changes in file .github/workflows/bandit.yml: jobs: Changes in file .github/workflows/makefile-lint.yml: jobs: Changes in file Makefile: ifeq "$(RM)" "" install: init build must_be_root must_have_flake: Changes in file docs/FAQ.md: #### Default Port Changes in file tests/check_pip: function check_license_when_given_req() { Changes in file tests/test_usage.py: def test_invalid_Error_WHEN_cli_called_GIVEN_bad_input(self):
2 parents 9cba757 + 4b3927a commit afb147a

File tree

7 files changed

+98
-81
lines changed

7 files changed

+98
-81
lines changed

.github/tool_checkmake.sh

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
# .github/tool_checkmake.sh
6464
readonly SCRIPT_NAME="${0##*/}"
6565

66+
# local build path fix-up
67+
if [[ -d "./checkmake" ]] && [[ ":$PATH:" != *":./checkmake:"* ]] ; then
68+
PATH="${PATH:+"$PATH:"}./checkmake" ;
69+
export PATH ;
70+
fi
71+
6672
# USAGE:
6773
# ~$ check_command CMD
6874
# Arguments:
@@ -83,6 +89,8 @@ export -f check_command
8389
check_command sed ;
8490
check_command grep ;
8591
check_command cut ;
92+
check_command go ;
93+
8694
check_command checkmake ;
8795

8896
# USAGE:
@@ -115,19 +123,21 @@ process_checkmake_output() {
115123
local emsg="$2"
116124

117125
if ! output=$(checkmake "${file}" 2>&1); then
118-
printf "%s\n" "::error::checkmake failed: ${output}" >&2
119-
return 1
120-
fi
126+
printf "%s\n" "::error::checkmake failed!"
121127

122-
printf "%s\n" "${output}" | \
123-
sed -e 's/ /:/g' | \
124-
tr -s ':' | \
125-
cut -d: -f 3-5 | \
126-
grep -F "${file}" | \
127-
sed -E -e 's/^[[:space:]]+//g' | \
128-
while IFS= read -r line; do
129-
printf "%s\n" "::warning file=${file},title=LINT::${line} ${emsg}" >&2
130-
done
128+
printf "%s\n" "${output}" | \
129+
sed -e 's/ /:/g' | \
130+
tr -s ':' | \
131+
cut -d: -f 3-5 | \
132+
grep -F "${file}" | \
133+
sed -E -e 's/^[[:space:]]+//g' | \
134+
while IFS= read -r line; do
135+
printf "%s\n" "::warning file=${file},title=LINT::${line} ${emsg}" >&2
136+
done
137+
return 1
138+
else
139+
printf "%s\n" "::notice file=${file},title=LINT::OK - No lint errors." >&2
140+
fi ;
131141
}
132142

133143
process_checkmake_output "${FILE}" "${EMSG}"

.github/workflows/bandit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
uses: reactive-firewall/[email protected]
3737
with: # optional arguments
3838
# exit with 0, even with results found
39-
# exit_zero: false # optional, default is DEFAULT
39+
exit_zero: true # optional, default is DEFAULT
4040
# Github token of the repository (automatically created by Github)
4141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information.
4242
# File or directory to run bandit on
@@ -46,7 +46,7 @@ jobs:
4646
# level: MEDIUM # optional, default is UNDEFINED
4747
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH.
4848
# Default is UNDEFINED (everything)
49-
confidence: LOW # optional, default is UNDEFINED
49+
# confidence: # optional, default is UNDEFINED
5050
# comma-separated list of paths (glob patterns supported) to exclude from scan
5151
# (note that these are in addition to the excluded paths provided in the config file)
5252
# (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)

.github/workflows/makefile-lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ jobs:
3232
if: ${{ success() }}
3333
run: |
3434
yamllint ${{ vars.YAML_ARGS }} .github/workflows/makefile-lint.yml
35-
- uses: actions/checkout@v4
3635
- name: Install checkmake
3736
if: ${{ success() }}
3837
env:
3938
BUILDER_NAME: "makefile-lint"
4039
BUILDER_EMAIL: "no-reply@localhost"
4140
run: |
42-
git clone --depth 1 --branch 0.2.2 https://github.com/mrtazz/checkmake.git checkmake
41+
git clone --depth 1 --branch main https://github.com/mrtazz/checkmake.git checkmake
4342
cd checkmake
44-
EXPECTED_SHA="48ab7819837d1bdfcbac58e301478a06efebf4a8" # v0.2.2
43+
EXPECTED_SHA="bd26d7905e47713ff0bf3b0e5e7b9c55f0d24e53" # v0.2.2+8
4544
ACTUAL_SHA=$(git rev-parse HEAD)
4645
if [ "$EXPECTED_SHA" != "$ACTUAL_SHA" ]; then
4746
ERR_MSG_STUB="Checkmake repository hash verification failed."
@@ -50,13 +49,14 @@ jobs:
5049
printf "%s\n" "${ERR_MSG_LINE}"
5150
exit 1;
5251
fi
53-
make || { \
52+
make && make install || { \
5453
ERR_MSG_STUB="Checkmake build failed." \
55-
ERR_DETS="file=.github/workflows/makefile-lint.yml,line=52,endLine=57,title=FAILURE" \
54+
ERR_DETS="file=.github/workflows/makefile-lint.yml,line=52,endLine=59,title=FAILURE" \
5655
ERR_MSG_LINE="::error ${ERR_DETS}::ERROR ${ERR_MSG_STUB}" \
5756
printf "%s\n" "${ERR_MSG_LINE}" \
5857
exit 1 \
5958
;}
59+
wait ;
6060
cd ..
6161
- name: Get makefiles Files
6262
id: makefiles

Makefile

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -139,27 +139,10 @@ ifeq "$(RMDIR)" ""
139139
RMDIR=$(RM)Rd
140140
endif
141141

142-
.PHONY: cleanup init clean-docs must_be_root must_have_flake must_have_pytest uninstall
142+
.PHONY: all clean test cleanup init help clean-docs must_be_root must_have_flake must_have_pytest uninstall cleanup-dev-backups
143143

144144
help:
145-
$(QUIET)$(ECHO) "HELP"
146-
$(QUIET)$(ECHO) " * house-keeping" ;
147-
$(QUIET)$(ECHO) " make help - this help text" ;
148-
$(QUIET)$(ECHO) " make build - packages the module" ;
149-
$(QUIET)$(ECHO) " make clean - cleans up a bit" ;
150-
$(QUIET)$(ECHO) " make init - sets up requirements for first time" ;
151-
$(QUIET)$(ECHO) " * install/remove" ;
152-
$(QUIET)$(ECHO) " make install - installs the module properly" ;
153-
$(QUIET)$(ECHO) " make user-install - trys an unprivliged install (may not work for some users)" ;
154-
$(QUIET)$(ECHO) " make uninstall - uninstalls the module" ;
155-
$(QUIET)$(ECHO) " make purge - uninstalls the module, and resets most related things" ;
156-
$(QUIET)$(ECHO) " (the big exception is init)" ;
157-
$(QUIET)$(ECHO) " * misc" ;
158-
$(QUIET)$(ECHO) " make build-docs - generate documentation (using sphinx)" ;
159-
$(QUIET)$(ECHO) " make test - run minimal acceptance testing" ;
160-
$(QUIET)$(ECHO) " make test-style - run some code-style testing" ;
161-
$(QUIET)$(ECHO) " make test-pytest - run extensive testing (with pytest)" ;
162-
$(QUIET)$(ECHO) "" ;
145+
$(QUIET)printf "HELP\nHouse-keeping:\n\tmake help - this help text\n\tmake build - packages the module\n\tmake clean - cleans up a bit\n\tmake init - sets up requirements for first time\nInstall/Remove:\n\tmake install - installs the module properly\n\tmake user-install - tries an unprivileged install (may not work for some users)\n\tmake uninstall - uninstalls the module\n\tmake purge - uninstalls the module, and resets most related things\n\t\t(the big exception is init)\nMisc:\n\tmake build-docs - generate documentation (using sphinx)\n\tmake test - run minimal acceptance testing\n\tmake test-style - run some code-style testing\n\tmake test-pytest - run extensive testing (with pytest)\n\n";
163146

164147
MANIFEST.in: init
165148
$(QUIET)$(ECHO) "include requirements.txt" >"$@" ;
@@ -202,20 +185,25 @@ uninstall:
202185
$(QUITE)$(WAIT)
203186
$(QUIET)$(ECHO) "$@: Done."
204187

205-
purge: clean uninstall
188+
legacy-purge: clean uninstall
206189
$(QUIET)$(PYTHON) -W ignore ./setup.py uninstall 2>$(ERROR_LOG_PATH) || :
207190
$(QUIET)$(PYTHON) -W ignore ./setup.py clean 2>$(ERROR_LOG_PATH) || :
208191
$(QUIET)$(RMDIR) ./build/ 2>$(ERROR_LOG_PATH) || :
209192
$(QUIET)$(RMDIR) ./dist/ 2>$(ERROR_LOG_PATH) || :
210193
$(QUIET)$(RMDIR) ./.eggs/ 2>$(ERROR_LOG_PATH) || :
211-
$(QUIET)$(RM) ./test-reports/junit.xml 2>$(ERROR_LOG_PATH) || :
194+
195+
purge: legacy-purge
196+
$(QUIET)$(RM) ./test-reports/*.xml 2>$(ERROR_LOG_PATH) || :
212197
$(QUIET)$(RMDIR) ./test-reports/ 2>$(ERROR_LOG_PATH) || :
213198
$(QUIET)$(ECHO) "$@: Done."
214199

215-
test: cleanup MANIFEST.in
200+
just-test: cleanup MANIFEST.in
216201
$(QUIET)$(COVERAGE) run -p --source=multicast -m unittest discover --verbose --buffer -s ./tests -t $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) || $(PYTHON) -m unittest discover --verbose --buffer -s ./tests -t ./ || DO_FAIL="exit 2" ;
217202
$(QUITE)$(WAIT) ;
218203
$(QUIET)$(DO_FAIL) ;
204+
205+
test: just-test
206+
$(QUIET)$(DO_FAIL) ;
219207
$(QUIET)$(COVERAGE) combine 2>$(ERROR_LOG_PATH) || : ;
220208
$(QUIET)$(COVERAGE) report -m --include=* 2>$(ERROR_LOG_PATH) || : ;
221209
$(QUIET)$(ECHO) "$@: Done."
@@ -260,51 +248,65 @@ must_have_pytest: init
260248
$(QUIET)runner=`$(PYTHON) -m pip freeze --all | grep --count -oF pytest` ; \
261249
if test $$runner -le 0 ; then $(ECHO) "No python framework (pytest) found for test." ; exit 126 ; fi
262250

263-
cleanup:
264-
$(QUIET)$(RM) tests/*.pyc 2>$(ERROR_LOG_PATH) || true
265-
$(QUIET)$(RM) tests/*~ 2>$(ERROR_LOG_PATH) || true
266-
$(QUIET)$(RM) tests/__pycache__/* 2>$(ERROR_LOG_PATH) || true
267-
$(QUIET)$(RM) __pycache__/* 2>$(ERROR_LOG_PATH) || true
251+
cleanup-dev-backups::
252+
$(QUIET)$(RM) ./*/*~ 2>$(ERROR_LOG_PATH) || :
253+
$(QUIET)$(RM) ./.*/*~ 2>$(ERROR_LOG_PATH) || :
254+
$(QUIET)$(RM) ./**/*~ 2>$(ERROR_LOG_PATH) || :
255+
$(QUIET)$(RM) ./*~ 2>$(ERROR_LOG_PATH) || :
256+
$(QUIET)$(RM) ./.*~ 2>$(ERROR_LOG_PATH) || :
257+
258+
cleanup-mac-dir-store::
259+
$(QUIET)$(RM) ./.DS_Store 2>$(ERROR_LOG_PATH) || :
260+
$(QUIET)$(RM) ./*/.DS_Store 2>$(ERROR_LOG_PATH) || :
261+
$(QUIET)$(RM) ./*/.DS_Store 2>$(ERROR_LOG_PATH) || :
262+
$(QUIET)$(RM) ./*/**/.DS_Store 2>$(ERROR_LOG_PATH) || :
263+
264+
cleanup-py-caches: cleanup-dev-backups cleanup-mac-dir-store
265+
$(QUIET)$(RM) ./*.pyc 2>$(ERROR_LOG_PATH) || :
266+
$(QUIET)$(RM) ./*/*.pyc 2>$(ERROR_LOG_PATH) || :
267+
$(QUIET)$(RM) ./*/__pycache__/* 2>$(ERROR_LOG_PATH) || :
268+
$(QUIET)$(RM) ./*/*/*.pyc 2>$(ERROR_LOG_PATH) || :
269+
270+
cleanup-py-cache-dirs: cleanup-py-caches
271+
$(QUIET)$(RMDIR) ./tests/__pycache__ 2>$(ERROR_LOG_PATH) || :
272+
$(QUIET)$(RMDIR) ./*/__pycache__ 2>$(ERROR_LOG_PATH) || :
273+
$(QUIET)$(RMDIR) ./*/*/__pycache__ 2>$(ERROR_LOG_PATH) || :
274+
$(QUIET)$(RMDIR) ./__pycache__ 2>$(ERROR_LOG_PATH) || :
275+
276+
cleanup-hypothesis::
277+
$(QUIET)$(RM) ./.hypothesis/**/* 2>$(ERROR_LOG_PATH) || true
278+
$(QUIET)$(RM) ./.hypothesis/* 2>$(ERROR_LOG_PATH) || true
279+
$(QUIET)$(RMDIR) ./.hypothesis/ 2>$(ERROR_LOG_PATH) || true
280+
281+
cleanup-tests: cleanup-hypothesis cleanup-py-cache-dirs cleanup-py-caches
282+
$(QUIET)$(RM) ./test_env/**/* 2>$(ERROR_LOG_PATH) || true
283+
$(QUIET)$(RM) ./test_env/* 2>$(ERROR_LOG_PATH) || true
284+
$(QUIET)$(RMDIR) ./test_env/ 2>$(ERROR_LOG_PATH) || true
285+
$(QUIET)$(RMDIR) .pytest_cache/ 2>$(ERROR_LOG_PATH) || true
286+
$(QUIET)$(RMDIR) ./.tox/ 2>$(ERROR_LOG_PATH) || true
287+
288+
cleanup-multicast: cleanup-py-cache-dirs cleanup-py-caches
268289
$(QUIET)$(RM) multicast/*.pyc 2>$(ERROR_LOG_PATH) || true
269290
$(QUIET)$(RM) multicast/*~ 2>$(ERROR_LOG_PATH) || true
270291
$(QUIET)$(RM) multicast/__pycache__/* 2>$(ERROR_LOG_PATH) || true
271292
$(QUIET)$(RM) multicast/*/*.pyc 2>$(ERROR_LOG_PATH) || true
272-
$(QUIET)$(RM) multicast/*/*~ 2>$(ERROR_LOG_PATH) || true
273-
$(QUIET)$(RM) multicast/*.DS_Store 2>$(ERROR_LOG_PATH) || true
274-
$(QUIET)$(RM) multicast/*/*.DS_Store 2>$(ERROR_LOG_PATH) || true
275-
$(QUIET)$(RM) multicast/.DS_Store 2>$(ERROR_LOG_PATH) || true
276-
$(QUIET)$(RM) multicast/*/.DS_Store 2>$(ERROR_LOG_PATH) || true
277-
$(QUIET)$(RM) tests/.DS_Store 2>$(ERROR_LOG_PATH) || true
278-
$(QUIET)$(RM) tests/*/.DS_Store 2>$(ERROR_LOG_PATH) || true
293+
294+
cleanup-multicast-eggs: cleanup-dev-backups cleanup-mac-dir-store
279295
$(QUIET)$(RM) multicast.egg-info/* 2>$(ERROR_LOG_PATH) || true
280-
$(QUIET)$(RM) ./*.pyc 2>$(ERROR_LOG_PATH) || true
281-
$(QUIET)$(RM) ./.coverage 2>$(ERROR_LOG_PATH) || true
282-
$(QUIET)$(RM) ./coverage*.xml 2>$(ERROR_LOG_PATH) || true
283-
$(QUIET)$(RM) ./sitecustomize.py 2>$(ERROR_LOG_PATH) || true
284-
$(QUIET)$(RM) ./.DS_Store 2>$(ERROR_LOG_PATH) || true
285-
$(QUIET)$(RM) ./*/.DS_Store 2>$(ERROR_LOG_PATH) || true
286-
$(QUIET)$(RM) ./*/*~ 2>$(ERROR_LOG_PATH) || true
287-
$(QUIET)$(RM) ./.*/*~ 2>$(ERROR_LOG_PATH) || true
288-
$(QUIET)$(RM) ./*~ 2>$(ERROR_LOG_PATH) || true
289-
$(QUIET)$(RM) ./.*~ 2>$(ERROR_LOG_PATH) || true
296+
$(QUIET)$(RMDIR) multicast.egg-info 2>$(ERROR_LOG_PATH) || true
297+
$(QUIET)$(RMDIR) .eggs 2>$(ERROR_LOG_PATH) || true
298+
$(QUIET)$(RMDIR) ./.eggs/ 2>$(ERROR_LOG_PATH) || true
299+
300+
cleanup-src-dir: cleanup-dev-backups cleanup-mac-dir-store
290301
$(QUIET)$(RM) ./src/**/* 2>$(ERROR_LOG_PATH) || true
291302
$(QUIET)$(RM) ./src/* 2>$(ERROR_LOG_PATH) || true
292-
$(QUIET)$(RM) ./test_env/**/* 2>$(ERROR_LOG_PATH) || true
293-
$(QUIET)$(RM) ./test_env/* 2>$(ERROR_LOG_PATH) || true
294-
$(QUIET)$(RM) ./.hypothesis/**/* 2>$(ERROR_LOG_PATH) || true
295-
$(QUIET)$(RM) ./.hypothesis/* 2>$(ERROR_LOG_PATH) || true
296303
$(QUIET)$(RMDIR) ./src/ 2>$(ERROR_LOG_PATH) || true
297-
$(QUIET)$(RMDIR) tests/__pycache__ 2>$(ERROR_LOG_PATH) || true
298-
$(QUIET)$(RMDIR) multicast/__pycache__ 2>$(ERROR_LOG_PATH) || true
299-
$(QUIET)$(RMDIR) multicast/*/__pycache__ 2>$(ERROR_LOG_PATH) || true
300-
$(QUIET)$(RMDIR) ./__pycache__ 2>$(ERROR_LOG_PATH) || true
301-
$(QUIET)$(RMDIR) multicast.egg-info 2>$(ERROR_LOG_PATH) || true
302-
$(QUIET)$(RMDIR) .pytest_cache/ 2>$(ERROR_LOG_PATH) || true
303-
$(QUIET)$(RMDIR) .eggs 2>$(ERROR_LOG_PATH) || true
304-
$(QUIET)$(RMDIR) ./test_env/ 2>$(ERROR_LOG_PATH) || true
304+
305+
cleanup: cleanup-tests cleanup-multicast cleanup-multicast-eggs cleanup-src-dir
306+
$(QUIET)$(RM) ./.coverage 2>$(ERROR_LOG_PATH) || true
307+
$(QUIET)$(RM) ./coverage*.xml 2>$(ERROR_LOG_PATH) || true
308+
$(QUIET)$(RM) ./sitecustomize.py 2>$(ERROR_LOG_PATH) || true
305309
$(QUIET)$(RMDIR) ./test-reports/ 2>$(ERROR_LOG_PATH) || true
306-
$(QUIET)$(RMDIR) ./.tox/ 2>$(ERROR_LOG_PATH) || true
307-
$(QUIET)$(RMDIR) ./.hypothesis/ 2>$(ERROR_LOG_PATH) || true
308310
$(QUIET)$(WAIT) ;
309311

310312
build-docs: ./docs/ ./docs/Makefile docs-reqs

docs/FAQ.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ From the
199199
[documentation](https://github.com/reactive-firewall/multicast/blob/v1.4/multicast/__init__.py#L155):
200200
> Arbitrary port to use by default, though any dynamic and free port would work.
201201
202+
While developers and network admistrators must consider other factors in the real world deployment,
203+
it is fair to say any free port in the dynamic or "ephemeral" port range of `49152`-`65535` should
204+
work so far as this Multicast module is concerned.
205+
202206
* For `SAY` the port refers to the destination port.
203207
* for `RECV` and `HEAR` the port refers to the port to listen on.
204208

tests/check_pip

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
################################################################################
6262
#
6363
# check_pip: Audit and validate Python requirements files.
64-
# This, best-effort, script audits and validates Python requirements files using tools like pip-audit and pip-licenses.
64+
# This, best-effort, script audits and validates Python requirements
65+
# files using tools like pip-audit and pip-licenses.
6566
# It accomplishes the following tasks:
6667
# 1. Sets up a safe execution environment with resource limits and UTF-8 encoding.
6768
# 2. Checks for the existence and executability of required commands.
@@ -258,8 +259,8 @@ function check_license_when_given_req() {
258259
printf "::debug::%s\n" "venv setup ... (${SUB_CODE})" ;
259260
# Install the given Python modules using pip
260261
for module in $@ ; do
261-
printf "::debug::%s\n" "Checking license from package '$module' ..." ;
262-
REQ_SPEC=$(grep -F "$module" <(cat <"${_TEST_ROOT_DIR}"/$req_file | sed -E -e '/^[[:space:]]*$/d' | sed -E -e '/^[#]+.*$/d') | grep -m1 -F "$module" )
262+
printf "::debug::%s\n" "Checking license from package '${module}' ..." ;
263+
REQ_SPEC=$(grep -F "${module}" <(cat <"${_TEST_ROOT_DIR}"/$req_file | sed -E -e '/^[[:space:]]*$/d' | sed -E -e '/^[#]+.*$/d') | grep -m1 -F "$module" )
263264
ERR_MSG="pip install '$module' failed for $req_file." ;
264265
if [[ ("${SUB_CODE}" -eq 0) ]] && python3 -m pip install $PIP_COMMON_FLAGS $PIP_ENV_FLAGS "${REQ_SPEC};" 2>/dev/null ;
265266
then

tests/test_usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def test_invalid_Error_WHEN_cli_called_GIVEN_bad_input(self):
859859
err = None
860860
del err # skipcq - cleanup any error leaks early
861861
theResult = False
862-
assert theResult
862+
self.assertTrue(theResult, str("""Could Not handle negitive inputs"""))
863863

864864

865865
if __name__ == '__main__':

0 commit comments

Comments
 (0)