From 1c2b47fa06706f99754c2b5248906187badf8522 Mon Sep 17 00:00:00 2001
From: Karel van Klink <karel.vanklink@geant.org>
Date: Fri, 29 Nov 2024 16:38:49 +0100
Subject: [PATCH] Update CI, add missing acronyms, update ignored tokens for
 now docstring style

---
 .gitlab-ci.yml                                               | 2 +-
 docs/includes/glossary.md                                    | 4 ++++
 docs/test-docs.sh                                            | 4 ----
 docs/vale/.vale.ini                                          | 5 ++++-
 docs/vale/styles/config/vocabularies/geant-jargon/accept.txt | 5 +++++
 gso/auth/oidc.py                                             | 2 +-
 gso/workflows/l3_core_service/modify_l3_core_service.py      | 2 +-
 gso/workflows/tasks/validate_geant_products.py               | 2 ++
 test/cli/test_imports.py                                     | 2 +-
 9 files changed, 19 insertions(+), 9 deletions(-)
 delete mode 100755 docs/test-docs.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5dca71c9..f04ddf50 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -79,7 +79,7 @@ lint-documentation:
     - vale sync
 
   script:
-    - vale --glob='!*/migrations/*' $CI_PROJECT_DIR/docs/ $CI_PROJECT_DIR/gso/
+    - vale --glob='!*/migrations/*' $CI_PROJECT_DIR/docs/source $CI_PROJECT_DIR/gso/
 
 ##### Publish documentation artefacts
 publish-docs-prod-1:
diff --git a/docs/includes/glossary.md b/docs/includes/glossary.md
index fc93b30c..4df9f994 100644
--- a/docs/includes/glossary.md
+++ b/docs/includes/glossary.md
@@ -3,6 +3,7 @@
 *[BGP]: Border Gateway Protocol
 *[BSS]: Business Support Systems
 *[CFS]: Customer Facing Service
+*[CIDR]: Classless Inter-Domain Routing
 *[DCIM]: Datacenter Infrastructure Manager
 *[DHCP]: Dynamic Host Configuration Protocol
 *[DNS]: Domain Name System
@@ -24,6 +25,7 @@
 *[IS-IS]: Intermediate System to Intermediate System
 *[ISO]: International Standards Organisations
 *[L3VPN]: Layer 3 VPN
+*[LACP]: Link Aggregation Control Protocol
 *[LLDP]: Link-Layer Discovery Protocol
 *[LSO]: Lightweight Service Orchestrator
 *[MAC]: Medium Access Control
@@ -43,4 +45,6 @@
 *[TBA]: To be added
 *[UAT]: User Acceptance Testing
 *[VM]: Virtual Machine
+*[VRF]: Virtual Routing and Forwarding
+*[WAN]: Wide Area Network
 *[WFO]: Workflow Orchestrator
diff --git a/docs/test-docs.sh b/docs/test-docs.sh
deleted file mode 100755
index 55ce69cf..00000000
--- a/docs/test-docs.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-vale --config=vale/.vale.ini sync
-vale --glob='!*/migrations/*' --config=vale/.vale.ini source ../gso
diff --git a/docs/vale/.vale.ini b/docs/vale/.vale.ini
index 544ed75c..06742e1a 100644
--- a/docs/vale/.vale.ini
+++ b/docs/vale/.vale.ini
@@ -17,6 +17,7 @@ Microsoft.Passive = NO
 ; We are not a general audience
 Microsoft.GeneralURL = NO
 Microsoft.We = NO
+Microsoft.Vocab = NO
 
 [*.py]
 ; We only lint .rst and .py files
@@ -30,7 +31,9 @@ Microsoft.Negative = NO
 Microsoft.RangeFormat = NO
 Microsoft.SentenceLength = NO
 
-TokenIgnores = (:term:`\S+`), (:param \S+(?: \S+)?:), (:type \S+:), (:return \S+:), (:rtype: \S+), (:class:`\S+`)
+; This statement ignores the names of parameters in docstrings, the four spaces that prepend it and the one following it
+; are necessary.
+TokenIgnores =     \S+:
 
 [*.md]
 BasedOnStyles = Vale, proselint, Microsoft
diff --git a/docs/vale/styles/config/vocabularies/geant-jargon/accept.txt b/docs/vale/styles/config/vocabularies/geant-jargon/accept.txt
index f6c9a3eb..6373503d 100644
--- a/docs/vale/styles/config/vocabularies/geant-jargon/accept.txt
+++ b/docs/vale/styles/config/vocabularies/geant-jargon/accept.txt
@@ -7,7 +7,9 @@ Ansible
 BFD
 BGP
 BSS
+CIDR
 CFS
+CNAME
 DCIM
 DDI
 DHCP
@@ -38,6 +40,7 @@ IS-?IS
 ISO
 Kentik
 L3VPN
+LACP
 LAG
 LLDP
 LSO
@@ -71,7 +74,9 @@ UTC
 UUID
 V?LAN
 VM
+VRF
 Vereniging
+WAN
 WFO
 [Aa]ddress
 [Aa]llocate
diff --git a/gso/auth/oidc.py b/gso/auth/oidc.py
index 1a10f6ca..02720fe1 100644
--- a/gso/auth/oidc.py
+++ b/gso/auth/oidc.py
@@ -144,7 +144,7 @@ class OIDCAuthentication(OIDCAuth):
             raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail=response.text)
 
         if "active" not in data:
-            logger.error("Token doesn't have the mandatory 'active' key, probably caused by a caching problem")
+            logger.error("Token does not have the mandatory 'active' key, probably caused by a caching problem")
             raise HTTPException(status_code=HTTPStatus.UNAUTHORIZED, detail="Missing active key")
         if not data.get("active", False):
             logger.info("User is not active", user_info=data)
diff --git a/gso/workflows/l3_core_service/modify_l3_core_service.py b/gso/workflows/l3_core_service/modify_l3_core_service.py
index 630418f7..7dbeb486 100644
--- a/gso/workflows/l3_core_service/modify_l3_core_service.py
+++ b/gso/workflows/l3_core_service/modify_l3_core_service.py
@@ -154,7 +154,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
 
             geant_sid: str = current_sbp.geant_sid
             is_tagged: bool = current_sbp.is_tagged
-            # The SBP model doesn't require these five fields, but in the case of GÉANT IP OR IAS this will never
+            # The SBP model does not require these five fields, but in the case of GÉANT IP or IAS this will never
             # occur since it's a layer 3 service. The ignore statements are there to put our type checker at ease.
             vlan_id: VLAN_ID = current_sbp.vlan_id  # type: ignore[assignment]
             ipv4_address: IPv4AddressType = current_sbp.ipv4_address  # type: ignore[assignment]
diff --git a/gso/workflows/tasks/validate_geant_products.py b/gso/workflows/tasks/validate_geant_products.py
index ecbedb79..a7bfcdaa 100644
--- a/gso/workflows/tasks/validate_geant_products.py
+++ b/gso/workflows/tasks/validate_geant_products.py
@@ -1,5 +1,6 @@
 """A task that checks for all products in the database to be well-kept."""
 
+# .. vale off
 # Copyright 2019-2020 SURF.
 # Copyright 2024 GÉANT Vereniging.
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +14,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+# .. vale on
 
 from orchestrator.targets import Target
 from orchestrator.workflow import StepList, done, init, workflow
diff --git a/test/cli/test_imports.py b/test/cli/test_imports.py
index 17a1bc13..fa378703 100644
--- a/test/cli/test_imports.py
+++ b/test/cli/test_imports.py
@@ -555,7 +555,7 @@ def test_import_iptrunk_successful(mock_start_process, mock_sleep, iptrunk_data)
 @patch("gso.cli.imports.time.sleep")
 @patch("gso.cli.imports.start_process")
 def test_import_iptrunk_invalid_router_id_side_a_and_b(mock_start_process, mock_sleep, iptrunk_data, capfd):
-    broken_data = iptrunk_data(side_a_node="Doesn't exist", side_b_node="Also doesn't exist")
+    broken_data = iptrunk_data(side_a_node="Does not exist", side_b_node="Also does not exist")
     import_iptrunks(broken_data["path"])
 
     captured_output, _ = capfd.readouterr()
-- 
GitLab