From 6a31331787bb58791b0f32fde409f42bfba78b8e Mon Sep 17 00:00:00 2001 From: Serge Bibauw <sbibauw@gmail.com> Date: Thu, 24 Apr 2025 23:05:04 +0200 Subject: [PATCH] Fix lint --- CONTRIBUTING.md | 20 +++++++++---- backend/alembic/README | 2 +- docs/cal.com.md | 7 +++-- .../src/routes/admin/tasks/TaskForm.svelte | 6 ++-- .../src/routes/sessions/[id]/+page.svelte | 28 +++++++++---------- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 030f6592..02e0e700 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ This document aims to specify how we currently work on this project, and how to ## General organisation -To keep track of the past, present and future work, we use the gitlab repository as a source of trust for the progress of the project. All the bugs, *to do*, improvement ideas and discussions are developed in the [issues](https://forge.uclouvain.be/sbibauw/languagelab/-/issues). +To keep track of the past, present and future work, we use the gitlab repository as a source of trust for the progress of the project. All the bugs, _to do_, improvement ideas and discussions are developed in the [issues](https://forge.uclouvain.be/sbibauw/languagelab/-/issues). The issues are categorised using tags. There are two types of tags. Gray tags are used to specify the kind of issues: UX, Studies, AI, topics, ... New kinds could be created at any time to reflect the progress and the targets of the project. Colored tags are used to specify the priority of an issue. Here are the different priorities: @@ -12,7 +12,7 @@ The issues are categorised using tags. There are two types of tags. Gray tags ar - To do: New functionalities or improvements already discussed and validated. - Waiting: Issues where work has already started, but is waiting someone else's answer or opinion to continue. - To review: Developed functionalities and improvements waiting for a review. -- Nice to have: Non-priority features or improvements, that would be *nice to have*. +- Nice to have: Non-priority features or improvements, that would be _nice to have_. - Open for discussions: Features and improvements that still need more discussions before being started. - Won't: Rejected features and improvements. @@ -20,7 +20,6 @@ To keep track of who is working on what, it's better to assign our-self an issue The different planned versions and the issues assigned to them are presented in the form of [milestones](https://forge.uclouvain.be/sbibauw/languagelab/-/milestones). The general idea is to finish a milestone before working on the next one. - ## Getting started #### Requirements @@ -31,11 +30,12 @@ The different planned versions and the issues assigned to them are presented in #### Configuration -The application is configured using environment variables for both the frontend and the backend. The best way to specify them is through the `.env` file. +The application is configured using environment variables for both the frontend and the backend. The best way to specify them is through the `.env` file. Check `backend/app/config.py` and `frontend/src/lib/config.ts` for an extensive list of the environment variables in use and their default values. Here is a simple example: + ```sh LANGUAGELAB_JWT_SECRET_KEY=abc LANGUAGELAB_JWT_REFRESH_SECRET_KEY=efg @@ -44,6 +44,7 @@ LANGUAGELAB_ADMIN_PASSWORD=admin LANGUAGELAB_CALCOM_SECRET=hij ALLOWED_ORIGINS=* ``` + âš Be sure to NEVER push the `.env` to the repo, and to use long and random keys for tests and deployment âš #### Backend dependencies @@ -69,6 +70,7 @@ pip install -r ../requirements.txt #### Pre-Commit hooks The CI run `npm run lint` and `black --check --verbose` on every commit, on every branch. To prevent a failing CI, there is a pre-commit hook ([docs](https://git-scm.com/book/ms/v2/Customizing-Git-Git-Hooks)). To use it, you can configure the local repository to use the hooks available directly on the repository: + ```sh git config --local core.hooksPath .githooks ``` @@ -102,16 +104,20 @@ As alembic is backend-specific, you have to go into the `backend` folder for the :warning: Alembic versions work as a linked list. Each version refer it's previous and next version. To prevent having to tweak "weird" things, ensure you're up-to-date with any other version update. You could need to redo those steps if someone else merged a change in the meantime. To create a migration script, you can run + ```sh alembic revision -m "<change message>" ``` + It will tell you the name of the new file, where you can implement the changes. In most cases, you should only need to change the functions: - - `upgrade` contains all your changes - - `downgrade` drop them. This is **deeply advised** to allow to rollback in case of issue, especially in production. + +- `upgrade` contains all your changes +- `downgrade` drop them. This is **deeply advised** to allow to rollback in case of issue, especially in production. Here are the most useful alembic functions: + ```python # Create a table op.create_table( @@ -134,9 +140,11 @@ op.alter_column('account', 'id', new_column_name='uuid') ``` To update to the latest version: + ```sh alembic upgrade head ``` + :warning: You will also need to run that if someone else wrote a version. This is NOT automatic for the local environment. For more in depth information, check the [official documentation](https://alembic.sqlalchemy.org/en/latest/). diff --git a/backend/alembic/README b/backend/alembic/README index 98e4f9c4..2500aa1b 100644 --- a/backend/alembic/README +++ b/backend/alembic/README @@ -1 +1 @@ -Generic single-database configuration. \ No newline at end of file +Generic single-database configuration. diff --git a/docs/cal.com.md b/docs/cal.com.md index e77616c3..e8d55260 100644 --- a/docs/cal.com.md +++ b/docs/cal.com.md @@ -1,6 +1,7 @@ LanguageLab utilise le site https://cal.com pour programmer les séances entre les tuteurs et les étudiants. Afin que l'intégration soit réussie, il est nécessaire de suivre les étapes suivantes: - - Créer un compte sur https://cal.com. - - Créer un nouveau type d'événement de 60 mins (https://app.cal.com/event-types -> [+ Nouveau]) avec un nom cohérent, par exemple `languagelab-tutorat` - - Indiquer le lien de l'évenement dans https://languagelab.sipr.ucl.ac.be/tutor/timeslots. Example: `username/languagelab-tutorat` + +- Créer un compte sur https://cal.com. +- Créer un nouveau type d'événement de 60 mins (https://app.cal.com/event-types -> [+ Nouveau]) avec un nom cohérent, par exemple `languagelab-tutorat` +- Indiquer le lien de l'évenement dans https://languagelab.sipr.ucl.ac.be/tutor/timeslots. Example: `username/languagelab-tutorat` diff --git a/frontend/src/routes/admin/tasks/TaskForm.svelte b/frontend/src/routes/admin/tasks/TaskForm.svelte index a70a40f1..33169e2f 100644 --- a/frontend/src/routes/admin/tasks/TaskForm.svelte +++ b/frontend/src/routes/admin/tasks/TaskForm.svelte @@ -54,7 +54,7 @@ <label class="label" for="instructions">{$t('tasks.instructions')}</label> <textarea use:autosize - rows=2 + rows="2" class="input w-full" id="instructions" name="instructions" @@ -64,7 +64,7 @@ <label class="label" for="learnerInstructions">{$t('tasks.learnerInstructions')}</label> <textarea use:autosize - rows=2 + rows="2" class="input w-full" id="learnerInstructions" name="learnerInstructions" @@ -74,7 +74,7 @@ <label class="label" for="examples">{$t('tasks.examples')} *</label> <textarea use:autosize - rows=2 + rows="2" class="input w-full" id="examples" name="examples" diff --git a/frontend/src/routes/sessions/[id]/+page.svelte b/frontend/src/routes/sessions/[id]/+page.svelte index caad2967..84a9de89 100644 --- a/frontend/src/routes/sessions/[id]/+page.svelte +++ b/frontend/src/routes/sessions/[id]/+page.svelte @@ -165,24 +165,24 @@ <p> {currentTask.instructions} </p> + {/if} + {#if currentTask.examples} <p class="mt-2 text-sm"> {currentTask.examples} </p> - <div class="flex gap-2 mt-4"> - <button class="btn flex-grow" onclick={cancelTask}> - 🔙 {$t('button.cancel')} - </button> - <button class="btn btn-primary flex-grow" onclick={finishTask}> - âœ”ï¸ {$t('tasks.achieveTask')} - </button> - </div> - {/if} - {:else} - {#if currentTask.learnerInstructions} - <p> - {currentTask.learnerInstructions} - </p> {/if} + <div class="flex gap-2 mt-4"> + <button class="btn flex-grow" onclick={cancelTask}> + 🔙 {$t('button.cancel')} + </button> + <button class="btn btn-primary flex-grow" onclick={finishTask}> + âœ”ï¸ {$t('tasks.achieveTask')} + </button> + </div> + {:else if currentTask.learnerInstructions} + <p> + {currentTask.learnerInstructions} + </p> {/if} {/if} </div> -- GitLab