Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab
indent_size = 4
max_line_length = 80

[**/*.[ch]]
indent_style = space
indent_size = 4
max_line_length = 80

[{**/*.py,.ci/*}]
indent_style = space
indent_size = 4

[{scripts/*,.github/workflows/*}]
indent_style = space
indent_size = 2
28 changes: 14 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ jobs:
- uses: webfactory/[email protected]
continue-on-error: true
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: install-dependencies
run: |
.ci/check-sanity.sh
sudo apt-get update
sudo apt-get -q -y install build-essential cppcheck
.ci/check-sanity.sh
sudo apt-get update
sudo apt-get -q -y install build-essential cppcheck
- name: make
run: |
git clone [email protected]:sysprog21/lab0-c-private || echo "No provisioning profile found"
.ci/check-provisioning.sh
make
git clone [email protected]:sysprog21/lab0-c-private || echo "No provisioning profile found"
.ci/check-provisioning.sh
make
- name: make check
run: |
make check || (cat scripts/weeping.raw ; exit 1)
cat scripts/kirby.raw
make check || (cat scripts/weeping.raw ; exit 1)
cat scripts/kirby.raw
- name: make test
run: |
make test || (cat scripts/weeping.raw ; exit 1)
cat scripts/kirby.raw
make test || (cat scripts/weeping.raw ; exit 1)
cat scripts/kirby.raw

coding-style:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: coding convention
run: |
sudo apt-get install -q -y clang-format-18
.ci/check-newline.sh
.ci/check-format.sh
sudo apt-get install -q -y clang-format-18
.ci/check-newline.sh
.ci/check-format.sh
shell: bash
1 change: 1 addition & 0 deletions scripts/aspell-pws
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,4 @@ typedef
BitInt
noreturn
pragma
EditorConfig
21 changes: 10 additions & 11 deletions scripts/commit-msg.hook
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ get_all_match_positions() {

# skip if the target is not found
[ -z "$result" ] && continue

# output and update states
local line col
read -r line col <<< "$result"
Expand Down Expand Up @@ -250,13 +250,13 @@ validate_commit_message() {
# ------------------------------------------------------------------------------
ASPELL=$(which aspell)
if [ $? -ne 0 ]; then
echo "Aspell not installed - unable to check spelling"
echo "Aspell not installed - unable to check spelling"
else
LINE_NUMBER=1
MISSPELLED_WORDS=$(echo "$COMMIT_MSG_LINES[LINE_NUMBER]" | $ASPELL --lang=en --list --home-dir=scripts --personal=aspell-pws)
if [ -n "$MISSPELLED_WORDS" ]; then
add_warning LINE_NUMBER "Possible misspelled word(s): $MISSPELLED_WORDS"
fi
LINE_NUMBER=1
MISSPELLED_WORDS=$(echo "$COMMIT_MSG_LINES[LINE_NUMBER]" | $ASPELL --lang=en --list --home-dir=scripts --personal=aspell-pws)
if [ -n "$MISSPELLED_WORDS" ]; then
add_warning LINE_NUMBER "Possible misspelled word(s): $MISSPELLED_WORDS"
fi
fi

# 1. Separate subject from body with a blank line
Expand Down Expand Up @@ -453,7 +453,7 @@ validate_commit_message() {
FULL_COMMIT_MSG_WITH_SPACE=$(sed '/^[[:space:]]*#/d' "$COMMIT_MSG_FILE" | \
sed -E "/$TRAILER_REGEX/d" | sed -E "s@${URL_REGEX#^}@@g")
FULL_COMMIT_MSG=$(echo "$FULL_COMMIT_MSG_WITH_SPACE" | sed '/^[[:space:]]*$/d')

# Extended list of abusive words (case-insensitive).
# Adjust the list as needed.
ABUSIVE_WORDS_REGEX='\b(fuck|fucking|dick|shit|bitch|asshole|cunt|motherfucker|damn|crap|dumbass|piss)\b'
Expand All @@ -475,7 +475,7 @@ validate_commit_message() {
-e "s/(['\"][^'\"]*['\"])//g" \
-e "s/\bcommit[[:space:]]+[0-9a-fA-F]{7,40}\b/commit/g")
MSG_FOR_SPELLCHECK=$(echo "$MSG_FOR_SPELLCHECK_LINE_FINDING" | sed '/^[[:space:]]*$/d')

# Use aspell to list misspelled words according to American English, ignoring quoted text.
MISSPELLED_WORDS=$(echo "$MSG_FOR_SPELLCHECK" | $ASPELL --lang=en --list --home-dir=scripts --personal=aspell-pws)
if [ -n "$MISSPELLED_WORDS" ]; then
Expand Down Expand Up @@ -656,8 +656,7 @@ _gen_changeid_input() {
}

_gen_changeid() {
_gen_changeid_input |
git hash-object -t commit --stdin
_gen_changeid_input | git hash-object -t commit --stdin
}

# It's showtime.
Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-commit.hook
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ fi
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository.
if test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
ERROR: Attempt to add a non-ASCII file name.
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare-commit-msg.hook
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ COMMIT_MSG_FILE="$1"

# If the commit message file already contains non-comment lines, do nothing.
if grep -qE '^[^[:space:]#]' "$COMMIT_MSG_FILE"; then
exit 0
exit 0
fi

# Gather a list of staged (changed) files.
Expand Down
Loading