Skip to content

Commit

Permalink
infra/linters: Replace spellcheck with typos
Browse files Browse the repository at this point in the history
Spellcheck is difficult to maintain because it complains about every
unknown word, including technical terms, acronyms, and names.
Typos is a more relaxed spellchecker, which only complains about common
misspellings and lets the user handle new words such as the previous
examples.

The configuration in .github/.typos.toml allows ignoring strings that
match regexes, so we have a nice way of handling command outputs.

Signed-off-by: Alex Apostolescu <[email protected]>
  • Loading branch information
Alex-deVis committed Dec 15, 2024
1 parent 85302e1 commit f22c42d
Show file tree
Hide file tree
Showing 30 changed files with 80 additions and 69 deletions.
10 changes: 10 additions & 0 deletions .github/.typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[default]
# ```(console)?[\\s\\S]+?``` -> Ignore fenced sequences
# -\\w+|--\\w+ -> Ignore command flags
extend-ignore-re= ["```(console)?[\\s\\S]+?```", "-\\w+|--\\w+"]
[files]
extend-exclude = ["*.svg", "*.drawio", "ssh_key", "ssh_key.pub"]
[default.extend-words]
# word1 = "word2" to correct word1 to word2
# word3 = "word3" to consider word3 a valid word
VAS = "VAS"
11 changes: 6 additions & 5 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

spellcheck:
name: Spellcheck
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- name: Spellcheck
uses: open-education-hub/actions/spellcheck@main
- uses: actions/checkout@v4
- name: Typos
uses: crate-ci/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
config: .github/.typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(void)

time = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 1000;

printf("Array sum is %ld\nTime spent: %lu miliseconds\n", result, time);
printf("Array sum is %ld\nTime spent: %lu milliseconds\n", result, time);

free(array);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void queue_destroy(QUEUE *queue);
size_t queue_size(const QUEUE *queue);


/* Add elem to the end of queue. Returns 0 on succes and non-zero on
/* Add elem to the end of queue. Returns 0 on success and non-zero on
* failure.
*/
int queue_enqueue(QUEUE *queue, TCB *elem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void queue_destroy(QUEUE *queue);
size_t queue_size(const QUEUE *queue);


/* Add elem to the end of queue. Returns 0 on succes and non-zero on
/* Add elem to the end of queue. Returns 0 on success and non-zero on
* failure.
*/
int queue_enqueue(QUEUE *queue, TCB *elem);
Expand Down
2 changes: 1 addition & 1 deletion chapters/compute/scheduling/guides/libult/solution/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void queue_destroy(QUEUE *queue);
size_t queue_size(const QUEUE *queue);


/* Add elem to the end of queue. Returns 0 on succes and non-zero on
/* Add elem to the end of queue. Returns 0 on success and non-zero on
* failure.
*/
int queue_enqueue(QUEUE *queue, TCB *elem);
Expand Down
2 changes: 1 addition & 1 deletion chapters/compute/scheduling/guides/libult/support/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void queue_destroy(QUEUE *queue);
size_t queue_size(const QUEUE *queue);


/* Add elem to the end of queue. Returns 0 on succes and non-zero on
/* Add elem to the end of queue. Returns 0 on success and non-zero on
* failure.
*/
int queue_enqueue(QUEUE *queue, TCB *elem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void incrementVar()
// `atomicOp` is a template function. It can perform any simple
// operation, such as `+=`, &= or `-=`, atomically. The operations is
// given to the function as a template argument using the following
// construction: !"+=". The values in parantheses are the operands
// construction: !"+=". The values in parentheses are the operands
// of the atomic operation.
atomicOp!"+="(var, 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef struct CList
/* Returns object with first match of string or byte compare */
void * (* lastMatch) (struct CList *l, const void *o, size_t shift, size_t size, int string);
/* Returns object with last match of string or byte compare */
int (* index) (struct CList *l); /* Get index of previos search match */
int (* index) (struct CList *l); /* Get index of previous search match */

Check failure on line 62 in chapters/compute/synchronization/drills/tasks/threadsafe-data-struct/support/clist.h

View workflow job for this annotation

GitHub Actions / Checkpatch

ERROR:DOS_LINE_ENDINGS: DOS line endings

Check failure on line 62 in chapters/compute/synchronization/drills/tasks/threadsafe-data-struct/support/clist.h

View workflow job for this annotation

GitHub Actions / Checkpatch

WARNING:LEADING_SPACE: please, no spaces at the start of a line

Check failure on line 62 in chapters/compute/synchronization/drills/tasks/threadsafe-data-struct/support/clist.h

View workflow job for this annotation

GitHub Actions / Checkpatch

WARNING:SPACING: Unnecessary space before function pointer name

Check failure on line 62 in chapters/compute/synchronization/drills/tasks/threadsafe-data-struct/support/clist.h

View workflow job for this annotation

GitHub Actions / Checkpatch

WARNING:SPACING: Unnecessary space before function pointer arguments

Check failure on line 62 in chapters/compute/synchronization/drills/tasks/threadsafe-data-struct/support/clist.h

View workflow job for this annotation

GitHub Actions / Checkpatch

ERROR:SPACING: space prohibited after that '*' (ctx:BxW)
int (* swap) (struct CList *l, int a, int b); /* Swap, replace two items with index a b */
int (* allocSize) (struct CList *l); /* Get allocated size in items */
size_t (* itemSize) (struct CList *l); /* Get item size in bytes */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int main(void)

/******************************************************* POINTERS LIST */

/* If we want create list of objects located in diffent places of memory, */
/* If we want create list of objects located in different places of memory, */
/* let create pointers list or in our case "uintptr_t" address list */

printf("Size of 'uintptr_t' = %zu bytes\n", sizeof(uintptr_t));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void mutex_unlock(struct mutex *m)
* Prevents overhead from busy-waiting
* Threads move to WAITING state while waiting for the lock
* Introduces overhead from context switch
* Releasing a mutex held by another thread is [**undefinded behaviour**](https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html)
* Releasing a mutex held by another thread is [**undefined behaviour**](https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html)
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ void main(string[] args)

for (size_t i = 0; i < numProcesses; ++i)
{
size_t elemsPerThred = cast(size_t) ceil(
size_t elemsPerThread = cast(size_t) ceil(
(cast(double) ARR_LEN) / numProcesses);
size_t start = i * elemsPerThred;
size_t end = min(ARR_LEN, (i + 1) * elemsPerThred);
size_t start = i * elemsPerThread;
size_t end = min(ARR_LEN, (i + 1) * elemsPerThread);

// Spawn another process with the current one as its parent.
children[i] = fork();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(void)

time = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 1000;

printf("Array sum is %ld\nTime spent: %lu miliseconds\n", result, time);
printf("Array sum is %ld\nTime spent: %lu milliseconds\n", result, time);

free(array);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(void)

time = 1000 * (stop.tv_sec - start.tv_sec) + (stop.tv_usec - start.tv_usec) / 1000;

printf("Array sum is %ld\nTime spent: %lu miliseconds\n", result, time);
printf("Array sum is %ld\nTime spent: %lu milliseconds\n", result, time);

free(array);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ In case of a correct solution, you will get an output such as:

```text
./run_all_tests.sh
test_acess_read ........................ passed ... 9
test_acess_write ........................ passed ... 9
test_acess_exec ........................ passed ... 10
test_acess_read_write ........................ passed ... 12
test_acess_read_exec ........................ passed ... 12
test_acess_write_exec ........................ passed ... 12
test_acess_exec_read ........................ passed ... 12
test_acess_exec_write ........................ passed ... 12
test_acess_write_read ........................ passed ... 12
test_access_read ........................ passed ... 9
test_access_write ........................ passed ... 9
test_access_exec ........................ passed ... 10
test_access_read_write ........................ passed ... 12
test_access_read_exec ........................ passed ... 12
test_access_write_exec ........................ passed ... 12
test_access_exec_read ........................ passed ... 12
test_access_exec_write ........................ passed ... 12
test_access_write_read ........................ passed ... 12
Total: 100/100
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void access_handler(int signum, siginfo_t *si, void *arg)
return;
}

/* TODO 2: Obtain page strart address in start variable. */
/* TODO 2: Obtain page start address in start variable. */
start = (void *) ((unsigned long) si->si_addr & ~0xFFFUL);
log_debug("start: %p", start);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void do_exec(void *addr)
((void (*)(void)) addr)();
}

static int test_acess_read(void)
static int test_access_read(void)
{
void *addr;

Expand All @@ -42,7 +42,7 @@ static int test_acess_read(void)
return counter == 1;
}

static int test_acess_write(void)
static int test_access_write(void)
{
void *addr;

Expand All @@ -55,7 +55,7 @@ static int test_acess_write(void)
return counter == 2;
}

static int test_acess_exec(void)
static int test_access_exec(void)
{
void *addr;

Expand All @@ -68,7 +68,7 @@ static int test_acess_exec(void)
return counter == 3;
}

static int test_acess_read_write(void)
static int test_access_read_write(void)
{
void *addr;

Expand All @@ -82,7 +82,7 @@ static int test_acess_read_write(void)
return counter == 1;
}

static int test_acess_read_exec(void)
static int test_access_read_exec(void)
{
void *addr;

Expand All @@ -96,7 +96,7 @@ static int test_acess_read_exec(void)
return counter == 2;
}

static int test_acess_write_exec(void)
static int test_access_write_exec(void)
{
void *addr;

Expand All @@ -110,7 +110,7 @@ static int test_acess_write_exec(void)
return counter == 1;
}

static int test_acess_exec_read(void)
static int test_access_exec_read(void)
{
void *addr;

Expand All @@ -124,7 +124,7 @@ static int test_acess_exec_read(void)
return counter == 0;
}

static int test_acess_exec_write(void)
static int test_access_exec_write(void)
{
void *addr;

Expand All @@ -138,7 +138,7 @@ static int test_acess_exec_write(void)
return counter == 0;
}

static int test_acess_write_read(void)
static int test_access_write_read(void)
{
void *addr;

Expand All @@ -153,15 +153,15 @@ static int test_acess_write_read(void)
}

static struct graded_test all_tests[] = {
{ test_acess_read, "test_acess_read", 9 },
{ test_acess_write, "test_acess_write", 9 },
{ test_acess_exec, "test_acess_exec", 10 },
{ test_acess_read_write, "test_acess_read_write", 12 },
{ test_acess_read_exec, "test_acess_read_exec", 12 },
{ test_acess_write_exec, "test_acess_write_exec", 12 },
{ test_acess_exec_read, "test_acess_exec_read", 12 },
{ test_acess_exec_write, "test_acess_exec_write", 12 },
{ test_acess_write_read, "test_acess_write_read", 12 }
{ test_access_read, "test_access_read", 9 },
{ test_access_write, "test_access_write", 9 },
{ test_access_exec, "test_access_exec", 10 },
{ test_access_read_write, "test_access_read_write", 12 },
{ test_access_read_exec, "test_access_read_exec", 12 },
{ test_access_write_exec, "test_access_write_exec", 12 },
{ test_access_exec_read, "test_access_exec_read", 12 },
{ test_access_exec_write, "test_access_exec_write", 12 },
{ test_access_write_read, "test_access_write_read", 12 }
};

int main(void)
Expand Down
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ lab_structure:
- reading/copy-on-write.md
- guides/apache2.md
- guides/fork-faults.md
- title: Lab 8 - Syncronization
- title: Lab 8 - Synchronization
filename: lab8.md
content:
- tasks/race-condition.md
Expand Down Expand Up @@ -313,7 +313,7 @@ docusaurus:
- Not Race Condition: not-race-condition.md
- Lab 6 - Multiprocess and Multithread: lab6.md
- Lab 7 - Copy-on-Write: lab7.md
- Lab 8 - Syncronization: lab8.md
- Lab 8 - Synchronization: lab8.md
- IO:
path: /build/prepare_view/.view
extra:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ When data is received on the socket execute the parser and check for errors.
}

/* Start up / continue the parser.
* Note we pass recved==0 to signal that EOF has been recieved.
* Note we pass recved==0 to signal that EOF has been received.
*/
nparsed = http_parser_execute(parser, &settings, buf, recved);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ size_t http_parser_execute (http_parser *parser,
/* Here we call the headers_complete callback. This is somewhat
* different than other callbacks because if the user returns 1, we
* will interpret that as saying that this message has no body. This
* is needed for the annoying case of recieving a response to a HEAD
* is needed for the annoying case of receiving a response to a HEAD

Check failure on line 1386 in content/assignments/async-web-server/src/http-parser/http_parser.c

View workflow job for this annotation

GitHub Actions / Checkpatch

ERROR:CODE_INDENT: code indent should use tabs where possible
* request.
*/
if (settings->on_headers_complete) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typedef int ssize_t;
#endif


/* Maximium header size allowed */
/* Maximum header size allowed */
#define HTTP_MAX_HEADER_SIZE (80*1024)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ gen_big_test() {
elif [ $((CLIENT_NUM%4)) -eq 1 ]; then
cat "${BIG_DIR}/test_${CLIENT_NUM}" >> "$GEN_REF_FILE"
elif [ $((CLIENT_NUM%4)) -eq 2 ]; then
echo "Reseted the counter!" >> "$GEN_REF_FILE"
echo "Reset the counter!" >> "$GEN_REF_FILE"
else
echo "Error: $CHECKER_DIR/libfictional.so reset could not be executed." >> "$GEN_REF_FILE"
fi
Expand Down
2 changes: 1 addition & 1 deletion content/assignments/lambda-function-loader/tests/special.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ void reset(void)
{
/* Let's erase the history, shall we? */
counter = 0;
printf("Reseted the counter!\n");
printf("Reset the counter!\n");
}
2 changes: 1 addition & 1 deletion content/assignments/minishell/tests/_test/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ execute_cmd() {
mkdir -p "${OUT_DIR}" && cd "${OUT_DIR}" &>"$LOG_FILE" || exit 1
# shellcheck disable=SC2086
timeout "$TEST_TIMEOUT" $BUFFERING_WRAPPER $EXEC <"${INPUT}" &>"$OUTPUT"
# Ocasionally, in a virtualized environment, the diff that compares the
# Occasionally, in a virtualized environment, the diff that compares the
# target implementation with the reference output starts before the
# target implementation has finished writing files to disk. Handle this
# by mandating that all I/O buffers be flushed.
Expand Down
4 changes: 2 additions & 2 deletions content/assignments/minishell/util/parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ typedef enum {
* (the father of the current node in the parse tree)
* The root of the tree has up == NULL
* The parsed expressions do not contain parantheses, this means that
* The parsed expressions do not contain parentheses, this means that
* the following holds:
* for any op_lower that has a lower priority than op, there is no
* parent in the tree with op == op_lower
Expand Down Expand Up @@ -194,7 +194,7 @@ void parse_error(const char *str, const int where);
/*
* Call this to parse a line
* line must point to a string containig a single line
* line must point to a string containing a single line
* The line must end with "\r\n\0" or "\n\0" or "\0"
* (*root) must point to NULL ((*root) == NULL)
Expand Down
2 changes: 1 addition & 1 deletion content/assignments/minishell/util/parser/parser.l
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifdef _MSC_VER
/* Speaking of MS, they do not implement standard C;
* YY_USE_CONST is defined only if __STDC__ is defined;
* here is alread too late to redefine YY_USE_CONST so
* here is already too late to redefine YY_USE_CONST so
* we use pragma instead ^^.
*/
#pragma warning(disable:4090)
Expand Down
2 changes: 1 addition & 1 deletion content/assignments/minishell/util/parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static word_t * add_part_to_word(word_t * w, word_t * lst)
assert(w != NULL);

/*
we could insert at the beginnig and then invert the list
we could insert at the beginning and then invert the list
but this would make the code a bit more complicated
thus, we assume we have small lists and O(n*n) is acceptable
*/
Expand Down
2 changes: 1 addition & 1 deletion content/assignments/parallel-firewall/src/ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ typedef struct so_ring_buffer_t {
size_t len;
size_t cap;

/* TODO: Add syncronization primitives */
/* TODO: Add synchronization primitives */
} so_ring_buffer_t;

int ring_buffer_init(so_ring_buffer_t *rb, size_t cap);
Expand Down
Loading

0 comments on commit f22c42d

Please sign in to comment.