Skip to content

Replace stickler #159

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

Merged
merged 30 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c075801
[CI] Added yaml and markdown linting jobs to CI
reactive-firewall Oct 12, 2024
2193e33
[CI] Implemented makefile linter workflow (- WIP #55 -)
reactive-firewall Oct 12, 2024
218e4d2
Fix for .github/workflows/makefile-lint.yml
reactive-firewall Oct 12, 2024
1529e40
Update .github/workflows/makefile-lint.yml
reactive-firewall Oct 12, 2024
db0a1d2
[PATCH] fix to install go-lang for checkmake (- WIP #159 -)
reactive-firewall Oct 12, 2024
b6a5621
[PATCH] possible fix for makefile-lint
reactive-firewall Oct 13, 2024
0b5a91f
[PATCH] possible fix for makefile-lint part 2
reactive-firewall Oct 13, 2024
62cc151
[PATCH] possible fix for makefile-lint part 3
reactive-firewall Oct 13, 2024
522e5ed
[PATCH] possible fix for makefile-lint part 4
reactive-firewall Oct 13, 2024
0311e14
[PATCH] possible fix for makefile-lint part 5
reactive-firewall Oct 13, 2024
c7dc153
[PATCH] possible fix for makefile-lint part 6
reactive-firewall Oct 13, 2024
170a4d5
[PATCH] possible fix for makefile-lint part 7
reactive-firewall Oct 13, 2024
a29a2c4
[PATCH] possible fix for makefile-lint part 8
reactive-firewall Oct 13, 2024
511648a
[UPDATE] Apply suggestions from code review
reactive-firewall Oct 13, 2024
5bc89c1
[DOCUMENTATION] reformatting markdown as per linting (- WIP #79 & PR …
reactive-firewall Oct 14, 2024
7a7baa3
[DOCUMENTATION] reformatting markdown as per linting (- WIP PR #159 -)
reactive-firewall Oct 14, 2024
4631f12
[DOCUMENTATION] Updated and reformated as per linting (- WIP #73 & PR…
reactive-firewall Oct 14, 2024
cdc6b74
[PATCH] more fixes for CI.md
reactive-firewall Oct 14, 2024
3873a8c
[DOCUMENTATION] Reformating FAQ as per linter (- WIP PR #159 -)
reactive-firewall Oct 14, 2024
70e0197
[DOCUMENTATION] reformated as per linter (- WIP PR #159 -)
reactive-firewall Oct 14, 2024
2d64255
[DOCUMENTATION] Reformated as per linter (- WIP PR #159 -)
reactive-firewall Oct 14, 2024
2fcfb36
[PATCH] Fixed some typos
reactive-firewall Oct 14, 2024
8da1b2c
[PATCH] Fixed some typos Part 2
reactive-firewall Oct 14, 2024
26f6d34
[PATCH] Fixed some typos Part 3
reactive-firewall Oct 14, 2024
30333cf
[PATCH] Fixed some typos Part 4
reactive-firewall Oct 14, 2024
4614178
[PATCH] Fixed some typos Part 5
reactive-firewall Oct 14, 2024
d6af326
[PATCH] Fixed some typos Part 6
reactive-firewall Oct 14, 2024
2f9b48f
[PAATCH] Apply suggestions from code review
reactive-firewall Oct 14, 2024
c194e29
[PATCH] Fixed some typos Part 7
reactive-firewall Oct 14, 2024
19d6ac4
[PATCH] Update docs/FAQ.md
reactive-firewall Oct 14, 2024
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
213 changes: 213 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# .coderabbit.yaml
language: en
early_access: true
enable_free_tier: true
reviews:
enabled: true
profile: chill
instructions: >-
# Code Review Instructions

- Ensure the code follows best practices and coding standards.
- For **Python** code, follow
[PEP 20](https://www.python.org/dev/peps/pep-0020/) and
[CEP-8](https://gist.github.com/reactive-firewall/b7ee98df9e636a51806e62ef9c4ab161)
standards.
- For **BASH** and **Shellscript** code, follow
[Pure BASH Bible](https://github.com/dylanaraps/pure-bash-bible) and
[CEP-5](https://gist.github.com/reactive-firewall/3d2bd3cf37f87974df6f7bee31a05a89)
standards.
- Check all **BASH** files start with an
[extensive disclaimer](https://gist.github.com/reactive-firewall/866b42d175ae3ebefcb2a5878b30ea17).
- Check for security vulnerabilities and potential issues.
- Ensure the code follows the **DRY, AHA, and SOLID** principles.

# Documentation Review Instructions
- Verify that documentation and comments are clear and comprehensive.
- Verify that documentation and comments are free of spelling mistakes.
- Verify that technical documentation includes a "References" section at
the end of documentation, using the same format as actual RFCs, with
both "Normative References" and "Informative References".

# Test Code Review Instructions
- Ensure that test code is automated, comprehensive, and follows testing best practices.
- Verify that all critical functionality is covered by tests.
- Ensure that test code follow
[CEP-8](https://gist.github.com/reactive-firewall/d840ee9990e65f302ce2a8d78ebe73f6)

# Misc.
- Confirm that the code meets the project's requirements and objectives.
- Confirm that copyright years are up-to date whenever a file is changed.
request_changes_workflow: true
high_level_summary: true
high_level_summary_placeholder: '@coderabbitai summary'
auto_title_placeholder: '@coderabbitai'
review_status: true
poem: true
collapse_walkthrough: false
sequence_diagrams: true
changed_files_summary: true
labeling_instructions:
- label: Python Lang
instructions: Apply when the PR/MR contains changes to python source-code.
- label: Bash Lang
instructions: >-
Apply when the PR/MR contains changes to shell-scripts or BASH code
snippets.
- label: Make Lang
instructions: >-
Apply when the PR/MR contains changes to the file `Makefile` or makefile
code snippets.
- label: Documentation
instructions: >-
Apply whenever project documentation (namely markdown source-code) is
updated by the PR/MR. Also apply when PR contains a commit with a commit
message prefixed with "[DOCUMENTATION] "
- label: Linter
instructions: >-
Apply when the purpose of the PR/MR is related to fixing the feedback
from a linter. Also apply if suggested fixes are used and improve the
code's compliance with the PEP-8 standard.
path_filters: ['!*.xc*/**', '!node_modules/**', '!dist/**', '!build/**', '!.git/**', '!venv/**', '!__pycache__/**']
path_instructions:
- path: README.md
instructions: >-
1. Consider the file 'README.md' the overview/introduction of the project.
Also consider the 'README.md' file the first place to look for project documentation.

2. When reviewing the file 'README.md' it should be linted with help
from the tools `markdownlint` and `languagetool`, pointing out any issues.

3. You may assume the file 'README.md' will contain GitHub flavor Markdown.
- path: '**/*.py'
instructions: >-
When reviewing Python code for this project:

1. Prioritize portability over clarity, especially when dealing with cross-Python compatibility. However, with the priority in mind, do still consider improvements to clarity when relevant.

2. As a general guideline, consider the code style advocated in the PEP 8 standard (excluding the use of spaces for indentation) and evaluate suggested changes for code style compliance.

3. As a style convention, consider the code style advocated in [CEP-8](https://gist.github.com/reactive-firewall/b7ee98df9e636a51806e62ef9c4ab161) and evaluate suggested changes for code style compliance.

4. As a general guideline, try to provide any relevant, official, and supporting documentation links to any tool's suggestions in review comments. This guideline is important for posterity.

5. As a general rule, undocumented function definitions and class definitions in the project's Python code are assumed incomplete. Please consider suggesting a short summary of the code for any of these incomplete definitions as docstrings when reviewing.

6. Verify Flake8's configuration file is located at ".flake8.ini"
- path: tests/*
instructions: >-
When reviewing test code:

1. Prioritize portability over clarity, especially when dealing with cross-Python compatibility. However, with the priority in mind, do still consider improvements to clarity when relevant.

2. As a general guideline, consider the code style advocated in the PEP 8 standard (excluding the use of spaces for indentation) and evaluate suggested changes for code style compliance.

3. As a style convention, consider the code style advocated in [CEP-8](https://gist.github.com/reactive-firewall/b7ee98df9e636a51806e62ef9c4ab161) and evaluate suggested changes for code style compliance, pointing out any violations discovered.

4. As a general guideline, try to provide any relevant, official, and supporting documentation links to any tool's suggestions in review comments. This guideline is important for posterity.

5. As a project rule, Python source files with names prefixed by the string "test_" and located in the project's "tests" directory are the project's unit-testing code. It is safe, albeit a heuristic, to assume these are considered part of the project's minimal acceptance testing unless a justifying exception to this assumption is documented.

6. As a project rule, any files without extensions and with names prefixed by either the string "check_" or the string "test_", and located in the project's "tests" directory, are the project's non-unit test code. "Non-unit test" in this context refers to any type of testing other than unit testing, such as (but not limited to) functional testing, style linting, regression testing, etc. It can also be assumed that non-unit testing code is usually written as Bash shell scripts.
- path: requirements.txt
instructions: >-
* The project's own Python dependencies are recorded in 'requirements.txt' for production code.

* The project's testing-specific Python dependencies are recorded in 'tests/requirements.txt' and are used for testing the project.

* The project's documentation-specific Python dependencies are recorded in 'docs/requirements.txt' and are used only for generating Python-focused documentation for the project. 'docs/requirements.txt' may be absent if not applicable.

Consider these 'requirements.txt' files the records of truth regarding project dependencies.
- path: tests/requirements.txt
instructions: >-
* The multicast project's own dependencies are recorded in
'./requirements.txt' for production code.

* The multicast project's own test code dependencies are recorded in
'tests/requirements.txt' for testing the project.

Consider these the records of truth regarding project test code dependencies.
- path: .github/**
instructions: >-
* When the project is hosted on GitHub: All GitHub-specific configurations, templates, and tools should be found in the '.github' directory tree.

* 'actionlint' erroneously generates false positives when dealing with GitHub's `${{ ... }}` syntax in conditionals.

* 'actionlint' erroneously generates incorrect solutions when suggesting the removal of valid `${{ ... }}` syntax.
- path: docs/*
instructions: >-
When a project contains a `docs/` directory:

1. Consider the files in the `docs/` directory tree the core/main/in-depth documentation of the project. Also consider the 'docs/**.md' files the second place to look for project documentation after the 'README.md' file.

2. When reviewing the documentation files (e.g. `docs/**.md`), they should additionally be linted with help from the tool `markdownlint`, pointing out any issues.

3. When reviewing the documentation files in `docs/` directory, they should additionally be linted with help from the tool `languagetool`, pointing out any issues.
abort_on_close: true
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords: []
labels: []
drafts: false
base_branches:
- stable
- master
- HOTFIX-*
tools:
languagetool:
enabled: true
language: en-US
configuration:
level: picky
mother_tongue: en
dictionary:
- 'reactive-firewall'
- 'CEP-9'
- 'CEP-8'
- 'CEP-7'
- 'CEP-5'
- 'Shellscript'
- 'bash'
disabled_rules:
- EN_QUOTES
- CONSECUTIVE_SPACES
enabled_rules:
- STYLE
- EN_CONTRACTION_SPELLING
- EN_WORD_COHERENCY
- IT_IS_OBVIOUS
- TWELFTH_OF_NEVER
- OXFORD_SPELLING
- PASSIVE_VOICE
shellcheck:
enabled: true
ruff:
enabled: true
configuration:
extend_select:
- E # Pycodestyle errors (style issues)
- F # PyFlakes codes (logical errors)
- W # Pycodestyle warnings
- N # PEP 8 naming conventions
ignore:
- W191
- W391
- E117
- D208
line_length: 100
dummy_variable_rgx: '^(_.*|junk|extra)$' # Variables starting with '_' or named 'junk' or 'extras', are considered dummy variables
external:
flake8-blind-except: {}
flake8-docstrings: {}
flake8-comprehensions: {}
flake8-debugger: {}
flake8-eradicate: {}
# Include other Flake8 plugins as needed
markdownlint:
enabled: true
yamllint:
enabled: true
configuration_file: ".yamllint.conf"
chat:
auto_reply: true
78 changes: 78 additions & 0 deletions .github/tool_checkmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#! /bin/bash
# Disclaimer of Warranties.
# A. YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY
# APPLICABLE LAW, USE OF THIS SHELL SCRIPT AND ANY SERVICES PERFORMED
# BY OR ACCESSED THROUGH THIS SHELL SCRIPT IS AT YOUR SOLE RISK AND
# THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND
# EFFORT IS WITH YOU.
#
# B. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SHELL SCRIPT
# AND SERVICES ARE PROVIDED "AS IS" AND "AS AVAILABLE", WITH ALL FAULTS AND
# WITHOUT WARRANTY OF ANY KIND, AND THE AUTHOR OF THIS SHELL SCRIPT'S LICENSORS
# (COLLECTIVELY REFERRED TO AS "THE AUTHOR" FOR THE PURPOSES OF THIS DISCLAIMER)
# HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH RESPECT TO THIS SHELL SCRIPT
# SOFTWARE AND SERVICES, EITHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
# NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF
# MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE,
# ACCURACY, QUIET ENJOYMENT, AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS.
#
# C. THE AUTHOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE
# THE AUTHOR's SOFTWARE AND SERVICES, THAT THE FUNCTIONS CONTAINED IN, OR
# SERVICES PERFORMED OR PROVIDED BY, THIS SHELL SCRIPT WILL MEET YOUR
# REQUIREMENTS, THAT THE OPERATION OF THIS SHELL SCRIPT OR SERVICES WILL
# BE UNINTERRUPTED OR ERROR-FREE, THAT ANY SERVICES WILL CONTINUE TO BE MADE
# AVAILABLE, THAT THIS SHELL SCRIPT OR SERVICES WILL BE COMPATIBLE OR
# WORK WITH ANY THIRD PARTY SOFTWARE, APPLICATIONS OR THIRD PARTY SERVICES,
# OR THAT DEFECTS IN THIS SHELL SCRIPT OR SERVICES WILL BE CORRECTED.
# INSTALLATION OF THIS THE AUTHOR SOFTWARE MAY AFFECT THE USABILITY OF THIRD
# PARTY SOFTWARE, APPLICATIONS OR THIRD PARTY SERVICES.
#
# D. YOU FURTHER ACKNOWLEDGE THAT THIS SHELL SCRIPT AND SERVICES ARE NOT
# INTENDED OR SUITABLE FOR USE IN SITUATIONS OR ENVIRONMENTS WHERE THE FAILURE
# OR TIME DELAYS OF, OR ERRORS OR INACCURACIES IN, THE CONTENT, DATA OR
# INFORMATION PROVIDED BY THIS SHELL SCRIPT OR SERVICES COULD LEAD TO
# DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE,
# INCLUDING WITHOUT LIMITATION THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
# NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, LIFE SUPPORT OR
# WEAPONS SYSTEMS.
#
# E. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY THE AUTHOR
# SHALL CREATE A WARRANTY. SHOULD THIS SHELL SCRIPT OR SERVICES PROVE DEFECTIVE,
# YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
#
# Limitation of Liability.
# F. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT SHALL THE AUTHOR
# BE LIABLE FOR PERSONAL INJURY, OR ANY INCIDENTAL, SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES
# FOR LOSS OF PROFITS, CORRUPTION OR LOSS OF DATA, FAILURE TO TRANSMIT OR
# RECEIVE ANY DATA OR INFORMATION, BUSINESS INTERRUPTION OR ANY OTHER
# COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR
# INABILITY TO USE THIS SHELL SCRIPT OR SERVICES OR ANY THIRD PARTY
# SOFTWARE OR APPLICATIONS IN CONJUNCTION WITH THIS SHELL SCRIPT OR
# SERVICES, HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT,
# TORT OR OTHERWISE) AND EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
# OR LIMITATION OF LIABILITY FOR PERSONAL INJURY, OR OF INCIDENTAL OR
# CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event
# shall THE AUTHOR's total liability to you for all damages (other than as may
# be required by applicable law in cases involving personal injury) exceed
# the amount of five dollars ($5.00). The foregoing limitations will apply
# even if the above stated remedy fails of its essential purpose.
################################################################################
#
# .github/tool_checkmake.sh
FILE="${1}" ;
EMSG="Checkmake linter complained.";

# Check if file exists
if [[ ! ( -f "${FILE}" ) ]]; then
printf "%s\n" "::error file=${FILE},title=MISSING:: File '${FILE}' not found." >&2
exit 1
fi

# Main functionality
{ { checkmake "${FILE}" | sed -e 's/ /:/g' | tr -s ':' |\
cut -d: -f 3-5 ;} 2>/dev/null |\
grep -F "${FILE}" | sed -E -e 's/^[[:space:]]+//g' |\
xargs -I{} printf "::warning file=${FILE},title=LINT::%s ${EMSG}\n" {} >&2 ;}
wait ;
61 changes: 61 additions & 0 deletions .github/workflows/makefile-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# .github/workflows/makefile-lint.yml
---
name: Makefile Lint
on: # yamllint disable-line rule:truthy
push:
branches: ["main", "master", "stable", feature*]
pull_request:
branches: ["main", "master", "stable"]

permissions: {} # Setting default permissions to none for enhanced security

jobs:
makefile-lint:
permissions:
contents: read
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Apt-Get Dependencies
run: |
sudo apt-get update
sudo apt-get install -y yamllint golang-go pandoc
go version
- name: Lint Workflow YAML
run: |
yamllint -f github --no-warnings .github/workflows/makefile-lint.yml
- uses: actions/checkout@v4
- name: Install checkmake
if: ${{ success() }}
env:
BUILDER_NAME: "ci"
BUILDER_EMAIL: "no-reply@localhost"
run: |
git clone https://github.com/mrtazz/checkmake.git checkmake
cd checkmake
make
cd ..
- name: Get makefiles Files
id: makefiles
shell: bash
run: |
FILES=$(git ls-files --exclude-standard -- Makefile 2>/dev/null)
if [ -z "$FILES" ]; then
printf "%s\n" "No Makefiles found."
printf "%s\n" "files=" >> "$GITHUB_OUTPUT"
else
printf "%s\n" "Makefiles found:"
printf "%s\n" "$FILES"
# Replace line breaks with spaces for tools
FILES="${FILES//$'\n'/ }"
printf "%s\n" "files=$FILES" >> "$GITHUB_OUTPUT"
fi
if: ${{ success() }}
- name: Lint Makefiles Files
run: |
FILE="${{ steps.makefiles.outputs.files }}" ;
printf "::group::%s\n" "${FILE}" ;
.github/tool_checkmake.sh "${FILE}" ;
printf "::endgroup::\n" ; unset FILE 2>/dev/null || true ;
if: ${{ !cancelled() && steps.makefiles.outputs.files != '' }}
Loading
Loading