Skip to content

Commit 2dc6f66

Browse files
[PATCH] Even more Improvements (- WIP PR #448 -)
Changes in file .coderabbit.yaml: * minor style changes Changes in file .github/actions/purge-test-reporter/action.yml: * minor re-wording Changes in file .github/dependabot.yml: * changes to better reflect dependencies Changes in file .github/workflows/CI-BUILD.yml: * minor improvements Changes in file .github/workflows/scorecard.yml: * minor changes Changes in file Makefile: * improvement to coverage logic slightly Changes in file README.md: * minor tweak to example Changes in file multicast/hear.py: * minor style change Changes in file tests/test_hear_cleanup.py: * re-re-re fix for misleading comments
1 parent 05ccd09 commit 2dc6f66

File tree

9 files changed

+56
-22
lines changed

9 files changed

+56
-22
lines changed

.coderabbit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ reviews:
3535
- Verify that technical documentation includes a "References" section at
3636
the end of documentation, using the same format as actual RFCs, with
3737
both "Normative References" and "Informative References". Suggest improvements if unable.
38-
- Ensure that that project documentation and comments follow
38+
- Ensure that the project documentation and source-code comments follow
3939
[CEP-7](https://gist.github.com/reactive-firewall/123b8a45f1bdeb064079e0524a29ec20)
4040
4141
# Test Code Review Instructions

.github/actions/purge-test-reporter/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ runs:
7878
DEEPSOURCE_DSN: ${{ github.server_url == 'https://github.com' && inputs.deepsource-dsn || '' }}
7979
run: |
8080
${{ github.workspace }}/.github/tools/fetch-test-reporter/purge-test-reporter || exit $?
81-
- name: "Evaluate Fetch Task"
81+
- name: "Evaluate Purge Task"
8282
id: purge_outcome
8383
if: ${{ !cancelled() }}
8484
shell: bash

.github/dependabot.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ updates:
99
directory: "/" # Location of package manifests
1010
milestone: 1
1111
target-branch: "master"
12-
versioning-strategy: increase-if-necessary
12+
versioning-strategy: increase
1313
# Labels on pull requests for version updates only
1414
labels:
1515
- "Configs"
@@ -29,6 +29,11 @@ updates:
2929
dependency-type: "production"
3030
- dependency-name: "build"
3131
dependency-type: "production"
32+
ignore:
33+
- dependency-name: "*"
34+
dependency-type: "development"
35+
- dependency-name: "*"
36+
dependency-type: "indirect"
3237
assignees:
3338
- "reactive-firewall"
3439
commit-message:
@@ -47,23 +52,32 @@ updates:
4752
- "Testing"
4853
- "Python Lang"
4954
- "CI"
50-
rebase-strategy: "disabled"
5155
groups:
5256
production-dependencies:
5357
dependency-type: "production"
58+
patterns:
59+
- "pip"
60+
- "setuptools"
61+
- "wheel"
62+
- "build"
5463
development-dependencies:
5564
dependency-type: "development"
5665
exclude-patterns:
66+
- "pip"
5767
- "setuptools*"
68+
- "wheel"
69+
- "build"
5870
allow:
5971
- dependency-name: "setuptools"
6072
dependency-type: "production"
6173
- dependency-name: "pip"
62-
dependency-type: "direct"
74+
dependency-type: "production"
6375
- dependency-name: "wheel"
6476
dependency-type: "production"
6577
- dependency-name: "build"
6678
dependency-type: "production"
79+
- dependency-name: "virtualenv"
80+
dependency-type: "development"
6781
- dependency-name: "tox"
6882
dependency-type: "development"
6983
- dependency-name: "virtualenv"
@@ -73,15 +87,22 @@ updates:
7387
- dependency-name: "pep8"
7488
dependency-type: "development"
7589
- dependency-name: "pytest"
76-
dependency-type: "direct"
90+
dependency-type: "development"
91+
- dependency-name: "pytest-doctestplus"
92+
dependency-type: "development"
7793
- dependency-name: "pytest-cov"
7894
dependency-type: "development"
7995
- dependency-name: "pytest-enabler"
8096
dependency-type: "development"
8197
- dependency-name: "pytest-flake8"
8298
dependency-type: "development"
8399
- dependency-name: "coverage"
100+
dependency-type: "development"
101+
ignore:
102+
- dependency-name: "*"
84103
dependency-type: "direct"
104+
- dependency-name: "*"
105+
dependency-type: "indirect"
85106
assignees:
86107
- "reactive-firewall"
87108
commit-message:
@@ -101,6 +122,7 @@ updates:
101122
- "Duplicate"
102123
- "GitHub"
103124
- "Testing"
125+
- "CI"
104126
assignees:
105127
- "reactive-firewall"
106128
commit-message:
@@ -122,8 +144,15 @@ updates:
122144
groups:
123145
development-dependencies:
124146
dependency-type: "development"
147+
patterns:
148+
- "markdownlint*"
125149
allow:
126-
- dependency-type: "development"
150+
- dependency-name: "markdownlint"
151+
dependency-type: "development"
152+
- dependency-name: "markdownlint-cli"
153+
dependency-type: "development"
154+
ignore:
155+
- dependency-name: "*"
127156
assignees:
128157
- "reactive-firewall"
129158
commit-message:

.github/workflows/CI-BUILD.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
LANG: "en_US.UTF-8"
4646
BUILD_MATCH_PATTERN: "${{ vars.BUILD_MATCH_PATTERN }}"
4747
outputs:
48+
build_environment: ${{ env.ENVIRONMENT }}
4849
build_status: ${{ steps.build.outcome }}
4950
artifact-id: ${{ steps.upload.outputs.artifact-id }}
5051
artifact-url: ${{ steps.upload.outputs.artifact-url }}
@@ -173,7 +174,7 @@ jobs:
173174
experimental: false
174175
- python-version: "${{ vars.PYTHON_EXPERIMENTAL }}"
175176
lang-var: "en_US.utf-8"
176-
experimental: ${{ (needs.BUILD.environment == 'Experimenting') }}
177+
experimental: ${{ (needs.BUILD.outputs.build_environment == 'Experimenting') }}
177178
outputs:
178179
bootstrap_status: ${{ steps.bootstrap.outcome }}
179180
env:
@@ -247,7 +248,7 @@ jobs:
247248
attestations: write
248249
needs: [BUILD]
249250
runs-on: ubuntu-latest
250-
environment: ${{ needs.BUILD.envs.ENVIRONMENT }}
251+
environment: ${{ needs.BUILD.outputs.build_environment }}
251252
if: ${{ !cancelled() && (github.repository == 'reactive-firewall-org/multicast') }}
252253
outputs:
253254
build-artifact-attestation-url: ${{ steps.multicast-build-attest.outputs.attestation-url }}
@@ -286,7 +287,7 @@ jobs:
286287
pull-requests: read
287288
needs: [BUILD, BOOTSTRAP, BUILD_ATTEST]
288289
runs-on: ubuntu-latest
289-
environment: ${{ needs.BUILD.envs.ENVIRONMENT }}
290+
environment: ${{ needs.BUILD.outputs.build_environment }}
290291
if: ${{ !cancelled() }}
291292
outputs:
292293
didBUILD: ${{ steps.check_status.outputs.build_success }}

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# .github/workflows/scorecard.yml
2-
# Referance: https://github.com/ossf/scorecard/blob/main/.github/workflows/scorecard-analysis.yml
2+
# Reference: https://github.com/ossf/scorecard/blob/main/.github/workflows/scorecard-analysis.yml
33
---
44
name: Scorecard analysis workflow
55
on: # yamllint disable-line rule:truthy

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ test: just-test
261261

262262
test-mats: test-mat
263263
$(QUIET)$(DO_FAIL) ;
264-
$(QUIET)$(COVERAGE) combine --keep ./coverage_* 2>$(ERROR_LOG_PATH) || : ;
265-
$(QUIET)$(COVERAGE) combine --append 2>$(ERROR_LOG_PATH) || : ;
264+
$(QUIET)$(COVERAGE) combine --data-file=coverage_mats ./.coverage.* 2>$(ERROR_LOG_PATH) || : ; \
265+
$(QUIET)$(COVERAGE) combine --keep --append ./coverage_* 2>$(ERROR_LOG_PATH) || : ; \
266266
$(QUIET)$(COVERAGE) report -m --include=multicast/* 2>$(ERROR_LOG_PATH) || : ;
267-
$(COVERAGE) xml -o test-reports/coverage.xml --include=multicast/* 2>$(ERROR_LOG_PATH) || : ;
267+
$(QUIET)$(COVERAGE) xml -o test-reports/coverage.xml --include=multicast/* 2>$(ERROR_LOG_PATH) || : ;
268268
$(QUIET)$(ECHO) "$@: Done."
269269

270-
test-tox: build
270+
test-tox: ./dist
271271
$(QUIET)$(PYTHON) -m tox -v --stderr-color RESET -- ;
272272
$(QUIET)$(ECHO) "$@: Done."
273273

@@ -414,8 +414,13 @@ must_have_flake:
414414
if test $$runner -le 0 ; then $(ECHO) "No Linter found for test." ; exit 126 ; fi
415415

416416
must_have_pytest: init
417-
$(QUIET)runner=`$(PYTHON) -m pip freeze --all | grep --count -oF pytest` ; \
418-
if test $$runner -le 0 ; then $(ECHO) "No python framework (pytest) found for test." ; exit 126 ; fi
417+
$(QUIET)if [ -n "$$TESTS_USE_PYTEST" ]; then \
418+
runner=`$(PYTHON) -m pip freeze --all | grep --count -oF pytest` ; \
419+
if test $$runner -le 0 ; then \
420+
$(ECHO) "No python framework (pytest) found for test." ; \
421+
exit 126 ; \
422+
fi ; \
423+
fi
419424

420425
cleanup-dev-backups::
421426
$(QUIET)$(RM) ./*/*~ 2>$(ERROR_LOG_PATH) || :

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ print('Received:', message)
153153
# setup console logging as example
154154
import logging
155155
multicast_logging_sink = logging.getLogger()
156-
handler = logging.StreamHandler()
157-
multicast_logging_sink.setLevel(logging.INFO) # increase default logging from multicast module
158156
handler = logging.StreamHandler() # example trivial log handler
157+
multicast_logging_sink.setLevel(logging.INFO) # increase default logging from multicast module
159158
multicast_logging_sink.addHandler(handler)
160159

161160
# import multicast

multicast/hear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def handle(self) -> None:
654654
By default:
655655
Processes the incoming data from the client, logs the messages,
656656
and sends a response back. If the data contains the
657-
keyword "STOP", it raises a `RuntimeError` to
657+
keyword "STOP", it raises a `ShutdownCommandReceived` to
658658
initiate server shutdown.
659659
Silently ignores any UnicodeDecodeError when decoding data.
660660
Returns early if data or socket is None.

tests/test_hear_cleanup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def test_should_not_invoke_kill_func_when_handle_error_not_called(self) -> None:
233233
self.server = multicast.hear.McastServer(server_address, None, False)
234234
self.server.shutdown = MagicMock() # Mock the shutdown method
235235
client_address = (self.get_default_ip(), _fixture_port_num)
236-
# Mock a request containing "STOP"
236+
# Mock a request not containing "STOP"
237237
request = ("Any other message with O, P, S, T", multicast.genSocket())
238238
# Add assertions for initial state
239239
self.assertIsNotNone(request[1], "Socket should be created")
@@ -277,7 +277,7 @@ def test_should_invoke_kill_func_when_handle_error_called(self) -> None:
277277
self.server = multicast.hear.McastServer(server_address, None, False)
278278
self.server.shutdown = MagicMock() # Mock the shutdown method
279279
client_address = (self.get_default_ip(), _fixture_port_num)
280-
# Mock a request not containing "STOP"
280+
# Mock a request containing "STOP"
281281
request = ("STOP message", multicast.genSocket())
282282
# Add assertions for initial state
283283
self.assertIsNotNone(request[1], "Socket should be created")

0 commit comments

Comments
 (0)