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 2 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
174 changes: 174 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# .coderabbit.yaml
language: en
reviews:
enabled: true
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
labeling_instructions: []
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 tool `markdownlint`, pointing out any issues.

3. You may assume '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: .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, they should be linted with help from the tool `markdownlint`, pointing out any issues.
abort_on_close: true
auto_review:
enabled: true
ignore_title_keywords: []
labels: []
drafts: false
base_branches:
- stable
- master
- main
- dev
- 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"
55 changes: 55 additions & 0 deletions .github/workflows/makefile-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# .github/workflows/makefile-lint.yml
---
name: Markefile 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 checkmake
- name: Lint Workflow YAML
run: |
yamllint -f github --no-warnings .github/workflows/makefile-lint.yml

- 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
if: ${{ !cancelled() }}
run: |
FILE="${{ steps.makefiles.outputs.files }}" ;
printf "::group::%s\n" "${FILE}" ;
{\
{ 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 -L1 -I{} printf "::warning:%s:0: Checkmake linter complained. See https://github.com/reactive-firewall/multicast/actions/runs/${{ github.run_id }}\n" ;} ;
wait ;
printf "::endgroup::\n" ; unset FILE 2>/dev/null || true ;
if: ${{ !cancelled() && steps.makefiles.outputs.files != '' }}

Check warning on line 55 in .github/workflows/makefile-lint.yml

View check run for this annotation

codefactor.io / CodeFactor

.github/workflows/makefile-lint.yml#L55

Duplication of key "if" in mapping. (key-duplicates)
50 changes: 50 additions & 0 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# .github/workflows/markdown-lint.yml
---
name: Markdown Lint
on:
push:
branches: ["main", "master", draft, draft*]
pull_request:
branches: ["main", "master"]

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

jobs:
markdown-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 npm

- name: Lint Workflow YAML
run: |
yamllint -f github --no-warnings .github/workflows/markdown-lint.yml

- name: Install NPM Dependencies
run: |
sudo npm install -g markdownlint
sudo npm install -g markdownlint-cli

- name: Lint YAML config for markdown
run: |
yamllint -f github --no-warnings .markdownlint.yaml

- name: Lint Markdown Files with YAML config
if: ${{ !cancelled() }}
run: |
git ls-files --exclude-standard -z -- *.md **/*.md |\
xargs -0 -I{} markdownlint "{}" --config .markdownlint.yaml ;

- name: Lint Markdown Files with JSON config
if: ${{ !cancelled() }}
run: |
git ls-files --exclude-standard -z -- *.md **/*.md |\
xargs -0 -I{} markdownlint "{}" --config .markdownlint.json ;
51 changes: 51 additions & 0 deletions .github/workflows/yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# .github/workflows/yaml-lint.yml
---
name: YAML 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:
yaml-lint:
permissions:
contents: read
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint Workflow YAML
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: .github/workflows/yaml-lint.yml
config_file: .yamllint.conf
format: github
no_warnings: true
if: ${{ !cancelled() }}
- name: Get YAML Files
id: yamlfiles
shell: bash
run: |
FILES=$(git ls-files --exclude-standard -- *.yaml *.yml **/*.yml ./.circleci/*.yml ./.github/**/*.yml )
if [ -z "$FILES" ]; then
printf "%s\n" "No YAML files found."
printf "%s\n" "files=" >> "$GITHUB_OUTPUT"
else
printf "%s\n" "YAML files found:"
printf "%s\n" "$FILES"
# Replace line breaks with spaces for yamllint
FILES="${FILES//$'\n'/ }"
printf "%s\n" "files=$FILES" >> "$GITHUB_OUTPUT"
fi
if: ${{ success() }}
- name: Lint YAML Files
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: ${{ steps.yamlfiles.outputs.files }}
config_file: .yamllint.conf
format: github
no_warnings: true
if: ${{ !cancelled() && steps.yamlfiles.outputs.files != '' }}
20 changes: 20 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"MD001": true,
"MD026": {
"punctuation": ",;:!"
},
"MD013": {
"line_length": 100,
"code_blocks": false,
"tables": false
},
"MD033": true,
"MD034": false,
"MD007": {
"indent": 2
},
"MD029": {
"style": "ordered"
},
"MD041": false
}
23 changes: 23 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .markdownlint.yaml
# extends: markdownlint:recommended

MD001: true # Enforce proper heading increments
MD026: # Disallow trailing punctuation in headings
punctuation: ",;:!" # - ('1.', '2.', etc. are ok though)

# Disable or customize rules
MD013: # Disable line length rule for flexibility
line_length: 100
code_blocks: false
tables: false
MD033: false # Allow inline HTML if needed
MD034: false # Allow bare URLs

# Customizations
MD007:
indent: 2 # Set unordered list indentation to 2 spaces
MD029:
style: ordered # Enforce ordered list item prefix style

# Exclusions
MD041: false # Allow files to start without a top-level heading
Loading