From d67b09528d4f84aee39b12fb75d871f989dea8d6 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 23 Oct 2024 14:46:17 -0400 Subject: [PATCH] Add codespell support (config, workflow to detect/not fix) and make it fix few typos (#413) * Add github action to codespell main on push and PRs * Add rudimentary codespell config * Add pre-commit definition for codespell * tune ups to codespellrc * [DATALAD RUNCMD] chore: run codespell throughout fixing typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --------- Co-authored-by: Daniel Xenes <39000785+dxenes1@users.noreply.github.com> --- .codespellrc | 7 ++++++ .github/workflows/codespell.yml | 25 +++++++++++++++++++ .pre-commit-config.yaml | 6 +++++ README.md | 4 +-- neuvue_project/templates/workspace.html | 2 +- neuvue_project/workspace/models.py | 2 +- .../workspace/static/getting_started.md | 21 +++++++++------- neuvue_project/workspace/static/updates.json | 4 +-- .../workspace/static/workspace/index.html | 2 +- neuvue_project/workspace/views/task.py | 2 +- 10 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 .codespellrc create mode 100644 .github/workflows/codespell.yml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..5782ae47 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,7 @@ +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = .git*,*.svg,package-lock.json,*.css,*-min.*,.codespellrc,*.bundle.*,*.map +check-hidden = true +# ignore-regex = +# some favorite albeit unfortunate variable names +ignore-words-list = te diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..c59e0473 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within .codespellrc +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f8fbe22..3668fddb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,3 +9,9 @@ repos: rev: 22.10.0 hooks: - id: black + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in .codespellrc + rev: v2.3.0 + hooks: + - id: codespell + diff --git a/README.md b/README.md index 71abed0d..cb477a83 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ pip install -r requirements.txt ## Development Installation -Install developer python requirements and set up pre-commit enviroment. +Install developer python requirements and set up pre-commit environment. ``` source venv/bin/activate @@ -102,7 +102,7 @@ Or perform each step individually: ## OAuth Set-up -The included development database is preconfigured to allow OAuth to authetnticate user accounts from `localhost:8000`. Here is a more [complete guide](https://www.section.io/engineering-education/django-google-oauth/) on how this was done. +The included development database is preconfigured to allow OAuth to authenticate user accounts from `localhost:8000`. Here is a more [complete guide](https://www.section.io/engineering-education/django-google-oauth/) on how this was done. We use `django-allauth` to connect Google OAuth to the Django environment. Users also have the option to log in through the base allauth login/signup page: diff --git a/neuvue_project/templates/workspace.html b/neuvue_project/templates/workspace.html index a2997ed5..a125f8ed 100644 --- a/neuvue_project/templates/workspace.html +++ b/neuvue_project/templates/workspace.html @@ -584,7 +584,7 @@ var char_to_key_code = {'c': 67, 'd': 68, 'j': 74, 'm': 77, 'q': 81, 'r': 82, 't': 84, 'v': 86, 'w': 87, 'y': 89, 'z': 90}; - // iterate through forced choice butttons to check for hotkey action + // iterate through forced choice buttons to check for hotkey action var button_list = document.getElementsByClassName('forcedChoiceButton'); for (var i = 0; i < button_list.length; i++) { var button = button_list.item(i); diff --git a/neuvue_project/workspace/models.py b/neuvue_project/workspace/models.py index b36b2dc1..ff308f5b 100644 --- a/neuvue_project/workspace/models.py +++ b/neuvue_project/workspace/models.py @@ -15,7 +15,7 @@ class NeuroglancerLinkType(models.TextChoices): Draws a path between all coordinates. point -> expects a list of coordinates (metadata), description (metadata), and - group (metadata). Needs atleast one seed point (points). Places dot points for + group (metadata). Needs at least one seed point (points). Places dot points for all coordinates listed. pregenerated -> neuroglancer state already added to task. Useful for external diff --git a/neuvue_project/workspace/static/getting_started.md b/neuvue_project/workspace/static/getting_started.md index 941ee450..acce78e1 100644 --- a/neuvue_project/workspace/static/getting_started.md +++ b/neuvue_project/workspace/static/getting_started.md @@ -26,8 +26,8 @@ Clicking on the blue row header for a task type will expand it to show a table w The pending table will show tasks for that task type ordered by descending priority level. The number in the tab after "Pending" show how many pending tasks are available. The columns are described below: -* **Task ID** - The unique identifer for this task. Useful for referencing task to NeuVue admins or developers as well as for inspecting the task in the "Inspect Task" page. Click on the task ID in this table will redirect you to the "Inspect Task" page for the task ID you clicked on. -* **Seg ID** - The unique identifier for the neuron in the volume that is the primary target for this proofreading task. Seg IDs will sometimes be repeated across many tasks or even users. Seg IDs also change after edits so a seg ID listed in the task page may be outdated by the time a user opens that task. More info here. +* **Task ID** - The unique identifier for this task. Useful for referencing task to NeuVue admins or developers as well as for inspecting the task in the "Inspect Task" page. Click on the task ID in this table will redirect you to the "Inspect Task" page for the task ID you clicked on. +* **Seg ID** - The unique identifier for the neuron in the volume that is the primary target for this proofreading task. Seg IDs will sometimes be repeated across many tasks or even users. Seg IDs also change after edits so a seg ID listed in the task page may be outdated by the time a user opens that task. More info here. * **Created** - EST Datetime of creation for this task. * **Priority** - Numerical priority of this task. Higher priority means that task will be provided to the user earlier in the queue. Skipping a task reduces the task priority by 1. * **Status** - Current status of the task. Four possible statuses: "open", "pending", "closed", "errored". Only "open" and "pending" tasks are shown in this table. @@ -46,9 +46,10 @@ The closed tab is slightly different than the pending tab. This table is sorted In addition to the task tables, you will also see buttons on the right side of the task type headers. These buttons are described below: -* **Start Proofreading** - This button exists for all task types with pending tasks available and assigned to you. Click this will nagivate you to the Workspace page, where the next task will automatically be queued up and displayed. -* **Add More Tasks** - Available for some task types only. Clicking this will allow additional tasks to be assigned to your user in cases where you deplete your queue or would like fresh tasks to work on. The number of tasks added to your user depends on the task type and there are certain limits set on how many tasks can be assigned to one user at a time. -* **Remove Skipped Tasks** - Available for some task types only. Clicking this will remove all tasks that have been skipped once or more from your queue permanently. + +* **Start Proofreading** - This button exists for all task types with pending tasks available and assigned to you. Click this will navigate you to the Workspace page, where the next task will automatically be queued up and displayed. +* **Add More Tasks** - Available for some task types only. Clicking this will allow additional tasks to be assigned to your user in cases where you deplete your queue or would like fresh tasks to work on. The number of tasks added to your user depends on the task type and there are certain limits set on how many tasks can be assigned to one user at a time. +* **Remove Skipped Tasks** - Available for some task types only. Clicking this will remove all tasks that have been skipped once or more from your queue permanently. From this point you can begin proofreading by deciding on which task types you would like to work on and then clicking "Start Proofreading" for that task type. This will navigate you to the workspace page, which is the main interface for proofreading work. @@ -88,7 +89,8 @@ Here is a great instructional video on how to operate Neuroglancer for basic nav -[This cheatsheet](https://docs.google.com/document/d/1eypqJ9iI1GlWSPMTZQo9oDCLEahye6oYo_CuhS_5QTA/edit?usp=sharing) (credit to flywire.ai) has additional useful information thats specific to this proofreading effort! +[This cheatsheet](https://docs.google.com/document/d/1eypqJ9iI1GlWSPMTZQo9oDCLEahye6oYo_CuhS_5QTA/edit?usp=sharing) (credit to flywire.ai) has additional useful information that's specific to this proofreading effort! + ## Additional Pages and Tools @@ -104,7 +106,8 @@ The inspect task page has a similar layout to the workspace except it does not c Synapse Viewer Page -The synapse viewer page is a visualization tool which means it can be accessed by any user with a valid root ID. It displays all presynaptic and postsynaptic locations for a valid root ID or multiple IDs. The pre and post annotations for each root ID are placed in an individual Neuroglancer layer so colors and sizes can be indepedently set. The sidebar displays information of on the number of connections for each root ID. This information can be copied or downloaded with the buttons below the table in the sidebar as well. To use the synaptic viewer, copy the list of root IDs (comma-separated) you want to visualize and paste them in the input box at app.neuvue.io/synapse. + +The synapse viewer page is a visualization tool which means it can be accessed by any user with a valid root ID. It displays all presynaptic and postsynaptic locations for a valid root ID or multiple IDs. The pre and post annotations for each root ID are placed in an individual Neuroglancer layer so colors and sizes can be independently set. The sidebar displays information of on the number of connections for each root ID. This information can be copied or downloaded with the buttons below the table in the sidebar as well. To use the synaptic viewer, copy the list of root IDs (comma-separated) you want to visualize and paste them in the input box at app.neuvue.io/synapse. Be aware that visualizing more than 10 root IDs at a time in the synpase viewer may cause Neuroglancer or your browser to crash! @@ -125,7 +128,7 @@ When a Neuroglancer link is copied from the app, it will use our externally host Any modern OS should work with NeuVue. To lower the chances of crashes or missing functionality, we recommend all users proofreading using Google Chrome. There have been compatibility issues with Safari and Firefox in the past. -### What should I do if I'm having a techical issue? +### What should I do if I'm having a technical issue? Copy the task ID and paste in the proofreading slack channel. Describe your issue in detail and paste your task ID, browser and OS as well. A NeuVue developer will then provide more specific instructions on how to troubleshoot or fix the issue. @@ -135,7 +138,7 @@ We recommend you do not refresh your browser when on the workspace page. This ca ### Is there an undo for Neuroglancer? -Yes, on the top right there will be an "undo/redo" arrow buttons that can be used to undo layer/ID selects, pans, zooms, and any changes to the Neuroglancer state. ** However, you cannot undo direct edits (i.e. splits/merges). ** To undo these, you can do the inverse operation for the undo, such as merging two accidently split IDs or splitting two accidently merged IDs. +Yes, on the top right there will be an "undo/redo" arrow buttons that can be used to undo layer/ID selects, pans, zooms, and any changes to the Neuroglancer state. ** However, you cannot undo direct edits (i.e. splits/merges). ** To undo these, you can do the inverse operation for the undo, such as merging two accidentally split IDs or splitting two accidentally merged IDs. ### How do I stop Neuroglancer from lagging/slowing down? diff --git a/neuvue_project/workspace/static/updates.json b/neuvue_project/workspace/static/updates.json index 16fc0f5c..1fefe28c 100644 --- a/neuvue_project/workspace/static/updates.json +++ b/neuvue_project/workspace/static/updates.json @@ -53,7 +53,7 @@ { "update_name": "v1.6.2", "update_date":"June 30th, 2022", - "update_description": "Allows tags to be saved when skipping, flagging, or exitting a task. Improved load times for admin tools." + "update_description": "Allows tags to be saved when skipping, flagging, or exiting a task. Improved load times for admin tools." }, { "update_name": "v1.6.1", @@ -73,7 +73,7 @@ { "update_name": "v1.5.3", "update_date":"April 28th, 2022", - "update_description": "Adds annotation color pallete preference. Updates to lineage viewer." + "update_description": "Adds annotation color palette preference. Updates to lineage viewer." }, { "update_name": "v1.5.2", diff --git a/neuvue_project/workspace/static/workspace/index.html b/neuvue_project/workspace/static/workspace/index.html index cd95cc2e..28296fed 100644 --- a/neuvue_project/workspace/static/workspace/index.html +++ b/neuvue_project/workspace/static/workspace/index.html @@ -29,7 +29,7 @@ (storage && storage.length !== 0); if (!outOfSpace) { - alert('Local Storage has been disabled, please renable it in Chrome'); + alert('Local Storage has been disabled, please re-enable it in Chrome'); } } } diff --git a/neuvue_project/workspace/views/task.py b/neuvue_project/workspace/views/task.py index a55e21f4..cac1df1d 100644 --- a/neuvue_project/workspace/views/task.py +++ b/neuvue_project/workspace/views/task.py @@ -213,7 +213,7 @@ def post(self, request, *args, **kwargs): max_tasks = namespace_obj.max_number_of_pending_tasks_per_user # Dev Note: Below is the logic for handling re-assignment of tasks. User levels default to novice and - # can be overriden by the user profile in the admin page. How levels affect what group the namespace + # can be overridden by the user profile in the admin page. How levels affect what group the namespace # belongs to depends on how the namespace configures the push to and pull from attributes. # By default, namespaces do not allow for reassignment.