-
Notifications
You must be signed in to change notification settings - Fork 0
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix Spellcheck script #111
Comments
@coderabbitai, read "https://github.com/kendrick-walls-work/XCMBuild/blob/main/tests/test_plists.bash" and consider that the main work of the script is performed by the tool
|
Tip For best results, initiate chat on the files or code changes. I've reviewed "test_plists.bash" and observed how Here's an example script: #!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Default exit code
EXIT_CODE=0
# Root directory to start from
_TEST_ROOT_DIR="$(pwd)"
# Find all files to check (exclude directories like .git, node_modules, etc.)
FILES_TO_CHECK=$(find "$_TEST_ROOT_DIR" -type f \( -name "*.py" -o -name "*.sh" -o -name "*.md" -o -name "*.txt" \) \
-not -path "*/\.git/*" -not -path "*/node_modules/*")
# Set codespell options
CODESPELL_OPTIONS="--quiet-level=2"
# Enable auto-correction if "--fix" argument is provided
if [[ "$1" == "--fix" ]]; then
CODESPELL_OPTIONS+=" --write-changes"
echo "Auto-correction enabled."
fi
# Iterate over files and run codespell
for FILE in $FILES_TO_CHECK; do
echo "Checking $FILE"
codespell $CODESPELL_OPTIONS "$FILE" || EXIT_CODE=$?
done
exit $EXIT_CODE Explanation:
Usage:
Integration:
Adjustments:
Let me know if this approach aligns with your requirements or if you'd like any further modifications. Analysis chainScripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Fetch "test_plists.bash" and display lines 137 to 150
curl -s https://raw.githubusercontent.com/kendrick-walls-work/XCMBuild/main/tests/test_plists.bash | sed -n '137,150p'
Length of output: 795 Learnings used
|
@coderabbitai, continuing our discussion from earlier in this issue #111 This is a fair start. Let's improve this logic a bit first:
|
Tip For best results, initiate chat on the files or code changes. Thank you for the feedback. I've updated the script to incorporate your suggestions:
Here's the revised script: #!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Default exit code
EXIT_CODE=0
# Check if 'codespell' is installed
if ! command -v codespell &> /dev/null; then
echo "codespell could not be found. Please install it before running this script."
exit 1
fi
# Check if 'git' is installed
if ! command -v git &> /dev/null; then
echo "git could not be found. Please install it before running this script."
exit 126
fi
# Get a list of all version-tracked files
FILES_TO_CHECK=$(git ls-files)
# Set codespell options
CODESPELL_OPTIONS="--quiet-level=2"
# Enable auto-correction if '--fix' argument is provided
if [[ "$1" == "--fix" ]]; then
CODESPELL_OPTIONS+=" --write-changes"
echo "Auto-correction enabled."
fi
# Iterate over files and run codespell
for FILE in $FILES_TO_CHECK; do
echo "Checking $FILE"
codespell $CODESPELL_OPTIONS "$FILE" || EXIT_CODE=$?
done
exit $EXIT_CODE Explanation:
Usage:
Please let me know if there are any further adjustments you'd like me to make. Learnings added
Learnings used
|
@coderabbitai, continuing our discussion in this issue #111 This is a step in the right direction. Let's improve this even more:
|
Tip For best results, initiate chat on the files or code changes. Thank you for the additional guidance. I've updated the
Here's the revised script: #!/bin/bash
# SPDX-License-Identifier: MIT
# spellcheck.sh - Spellcheck script using codespell
#
# This script checks for spelling errors using codespell.
# It can optionally auto-correct spelling errors.
#
# Exit Codes:
# 0 - Success
# 1 - General error
# 126 - Missing prerequisite
set -e
# Initialize default exit code
EXIT_CODE=0
# Set up trap to catch exits and interrupt signals
trap 'EXIT_CODE=$?; echo "Script exited with code $EXIT_CODE"; exit $EXIT_CODE' EXIT INT TERM
# Check prerequisites
if ! command -v codespell &> /dev/null; then
echo "codespell could not be found. Please install it before running this script."
exit 126
fi
if ! command -v git &> /dev/null; then
echo "git could not be found. Please install it before running this script."
exit 126
fi
# Get a list of files to check using git ls-tree with filtering
FILES_TO_CHECK=$(git ls-tree -r --full-tree --name-only HEAD -- '*.md' '*.py' '*.txt' '**/*.md' '**/*.txt' '**/*.py')
# Set codespell options
CODESPELL_OPTIONS="--quiet-level=2"
# Enable auto-correction if '--fix' argument is provided
if [[ "$1" == "--fix" ]]; then
CODESPELL_OPTIONS+=" --write-changes"
echo "Auto-correction enabled."
fi
# Iterate over files and run codespell
for FILE in $FILES_TO_CHECK; do
echo "Checking $FILE"
codespell $CODESPELL_OPTIONS "$FILE" || EXIT_CODE=$?
done
exit $EXIT_CODE Explanation:
Usage:
Notes:
Please review the updated script and let me know if there are any further adjustments or enhancements you'd like me to make.
Learnings used
|
Changes in file tests/check_spelling: * Overhauled as per #111 🎉
…st files (- WIP #110 & #111 -) Changes in file tests/MulticastUDPClient.py: * corrected some spelling, should be a better read Changes in file tests/context.py: * corrected some spelling, should be a better read Changes in file tests/test_usage.py: * corrected some spelling, should be a better read
…& #111 -) Changes in file multicast/__init__.py: * Fixed some typos Changes in file multicast/__main__.py: * Fixed some typos Changes in file multicast/hear.py: * Fixed some typos Changes in file multicast/recv.py: * Fixed some typos Changes in file multicast/send.py: * Fixed some typos Changes in file multicast/skt.py: * Fixed some typos * after several tests the new `tests/check_spelling` tool seems to work. Let this be the end of spelling issues in the code.
@coderabbitai, review issue #111 and read the changes made so far to the tool
|
Tip For best results, initiate chat on the files or code changes. Analysis of the Improved The enhanced Additive Enhancements:
Reductive Optimizations:
Breakdown of Current Functionality:
Conclusion: The refactored Please let me know if there are specific aspects you'd like to explore further or any adjustments needed in the analysis. Analysis chainScripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Fetch the content of issue #111
gh issue view 111 --repo reactive-firewall/multicast --json title,body
# Fetch the changes made to 'tests/check_spelling' in the specified commit
git show 8ab47e0f65090c4bb94d7d0d95eee26f3ad6f993 -- tests/check_spelling
Length of output: 7733 Learnings used
|
… WIP #110 & #111 -) Changes in file tests/test_usage.py: def test_Usage_Error_WHEN_the_help_command_is_called(self): * should be "assertIn" the function def test_equivilant_response_WHEN_absolute_vs_implicit(self): * should be "assertIn" the function def test_invalid_Error_WHEN_cli_called_GIVEN_bad_input(self): * should be "assertIn" the function def test_prints_usage_WHEN_called_GIVEN_cmd_and_help_argument(self): * should be "assertIn" the function def test_prints_usage_WHEN_called_GIVEN_help_argument(self): * should be "assertIn" the function
* PR #110 (feature-documentation-sphinx): [PATCH] Apply suggestions from code review (- WIP #110 -) [STYLE] Apply suggestions from code review (- WIP #110 -) [UPDATE] Bump Version in prep of release (- WIP #110 -) [PATCH] Apply suggestions from code review (- WIP #110 -) [HOTFIX] fixed CI regression by false-positive spelling correction (- WIP #110 & #111 -) [PATCH] Apply suggestions from code review (- WIP #110 -) [STYLE] corrected v-array to intended vary in comment (- WIP #110 -) [STYLE] Finished fixing with new tests/check_spelling tool (- WIP #110 & #111 -) [DOCUMENTATION] used new tests/check_spelling tool to fixup the docs (- WIP #110 & #111 -) [TESTS] used new tests/check_spelling tool to auto-fix spelling in test files (- WIP #110 & #111 -) [TESTING] fixup for CI with deepsource coverage (- WIP #110 -) [UPGRADE] fixed spellcheck tool (- WIP #111 -) [TESTING] Fixup for CI env where documentation gaps caused failures (- FIX #110 -) [TESTING] Re-enabling test blocking for style and adding docs/requirements.txt to CI (- WIP #110 -) Update docs/USAGE.md [STYLE] added Copyright line to source docs (- WIP #110 -) [DOCUMENTATION] Clearified setup the label from 'set up' the words (- WIP #79 -) [STYLE] Refactored some unrelated code for style compliance (- WIP #53 -) Apply MORE suggestions from code review [DOCUMENTATION] CI documentation tweaks (- WIP #110 -) [PATCH] More Fixes [STYLE] Apply suggestions from code review (- WIP #110 -) Apply suggestions from code review [DOCUMENTATION] Apply suggestions from code review (- WIP #110 -) [REGRESSION] Apply suggestions from code review (- WIP #110 -) [DOCUMENTATION] Improved Documentation hopefully (- WIP #104 & #110 -) [DOCUMENTATION] Fixed GH links for project and updated some docs (- WIP #79 & #110 -) [DOCUMENTATION] updated documentation configuration a bit. (- WIP #110 -) [HOTFIX] Fixup .gitignore file [DOCUMENTATION] debugged sphinx build features some more (- WIP #110 -) [DOCUMENTATION] Prototype documentation features via sphinx (- WIP #79 -) * PR #112 (patch-150-104-overhaul-readme): [STYLE] Apply suggestions from code review [PATCH] added new OSSF badge to security section (- WIP #104 -) [DOCUMENTATION] Drafted improved README (- WIP #104 -)
As discussed in PR #110 at this comment, we need to fix the spellcheck script to prevent typos like 'accross' in the future.
Requested by @reactive-firewall.
The text was updated successfully, but these errors were encountered: