From 917dc09585d7c3a5ed0e8346c17ef571b7187685 Mon Sep 17 00:00:00 2001 From: Karel van Klink <karel.vanklink@geant.org> Date: Thu, 5 Oct 2023 15:18:46 +0200 Subject: [PATCH] update Vale config, resolve a bunch of errors, warnings and suggestions --- docs/source/conf.py | 2 +- docs/source/modules.rst | 2 +- docs/source/quickstart.rst | 2 +- docs/vale/.vale.ini | 13 ++++++++----- gso/cli/netbox.py | 4 ++-- gso/services/infoblox.py | 5 ++--- gso/services/netbox_client.py | 5 ++--- gso/workflows/iptrunk/migrate_iptrunk.py | 13 ------------- 8 files changed, 17 insertions(+), 29 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 7126a483..329a95dd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,7 +19,7 @@ html_css_files = ['custom.css'] html_js_files = ['custom.js'] html_logo = 'static/geant_logo_white.svg' -# Both the class' and the __init__ method's docstring are concatenated and inserted. +# Both the class' and the ``__init__`` method's docstring are concatenated and inserted. autoclass_content = 'both' # Display todos by setting to True diff --git a/docs/source/modules.rst b/docs/source/modules.rst index 2a4c409b..37bab359 100644 --- a/docs/source/modules.rst +++ b/docs/source/modules.rst @@ -2,7 +2,7 @@ Sub-packages and -modules ========================= -This page contains references to the documentation of all sub-packages and -modules that make up :term:`GSO`. +This page lists references to the documentation of all sub-packages and -modules that make up :term:`GSO`. Subpackages ----------- diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 5b6c8ac2..bc9d7e0f 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -4,7 +4,7 @@ Quickstart Development environment and dependencies ---------------------------------------- -- Install python 3.10 if you don't have it already: +- Install python 3.10 if you do not have it already: - ``add-apt-repository ppa:deadsnakes/ppa`` - ``apt install python3.10 python3.10-distutils`` - Follow Steps 1 and 2 from here to install dependencies and setup DB: diff --git a/docs/vale/.vale.ini b/docs/vale/.vale.ini index 1f9ef177..9cac78e3 100644 --- a/docs/vale/.vale.ini +++ b/docs/vale/.vale.ini @@ -6,8 +6,8 @@ Vocab = geant-jargon, Sphinx Packages = proselint, Microsoft -[*.{md,py}] -; We only lint .md and .py files +[*.{py,rst}] +; We only lint .rst and .py files BasedOnStyles = Vale, proselint, Microsoft ; Some headers are generated and we have no real influence over them Microsoft.Headings = NO @@ -22,10 +22,13 @@ proselint.Typography = warning ; Same applies for not using contractions Microsoft.Contractions = NO custom.Contractions = YES +; Using a "regular" - instead of an en dash is totally fine +Microsoft.Negative = NO +Microsoft.RangeFormat = NO -TokenIgnores = (:term:), (:param \S+:), (:type \S+:) +TokenIgnores = (:term:`\S+`), (:param \S+(?: \S+)?:), (:type \S+:), (:return \S+:), (:rtype: \S+) -[*/glossary.md] +[*/glossary.rst] ; Ignore acronyms being undefined in the file that defines all acronyms by definition. Microsoft.Acronyms = NO Microsoft.Contractions = NO @@ -33,4 +36,4 @@ custom.Contractions = YES Microsoft.Passive = NO [formats] -py = md +py = rst diff --git a/gso/cli/netbox.py b/gso/cli/netbox.py index 97acdcf8..08694be5 100644 --- a/gso/cli/netbox.py +++ b/gso/cli/netbox.py @@ -11,7 +11,7 @@ def netbox_initial_setup() -> None: """Set up NetBox for the first time. It includes: - - Creating a default site (GEANT) + - Creating a default site (GÉANT) - Creating device roles (Router) """ typer.echo("Initial setup of NetBox ...") @@ -19,7 +19,7 @@ def netbox_initial_setup() -> None: nbclient = NetBoxClient() - typer.echo("Creating GEANT site ...") + typer.echo("Creating GÉANT site ...") try: nbclient.create_device_site("GEANT", "geant") typer.echo("Site created successfully.") diff --git a/gso/services/infoblox.py b/gso/services/infoblox.py index c1480074..7e902e94 100644 --- a/gso/services/infoblox.py +++ b/gso/services/infoblox.py @@ -72,8 +72,7 @@ def _allocate_network( def hostname_available(hostname: str) -> bool: """Check whether a hostname is still available **in Infoblox**. - Check whether Infoblox already contains a :class:`infoblox_client.objects.HostRecord` that matches the given - hostname. + Check whether Infoblox already has a :class:`infoblox_client.objects.HostRecord` that matches the given hostname. .. warning:: This method only checks within the Infoblox instance, and not the rest of the internet. The hostname could @@ -260,7 +259,7 @@ def delete_host_by_fqdn(fqdn: str) -> None: Delete a host record in Infoblox, by providing the :term:`FQDN` that is associated with the record. Raises a :class:`DeletionError` if no record can be found in Infoblox. - :param fqdn: The FQDN of the host record that should get deleted. + :param fqdn: The :term:`FQDN` of the host record that should get deleted. :type fqdn: str """ host = find_host_by_fqdn(fqdn) diff --git a/gso/services/netbox_client.py b/gso/services/netbox_client.py index a66aae86..f13fe477 100644 --- a/gso/services/netbox_client.py +++ b/gso/services/netbox_client.py @@ -70,9 +70,8 @@ class NetBoxClient: def create_interface(self, iface_name: str, type: str, speed: str, device_name: str) -> Interfaces: """Create new interface on a device, where device is defined by name. - The type parameter can be 1000base-t, 10gbase-t, lag... - For more details on type definition have a look in - choices.py in the netbox API implementation in module DCIM. + The type parameter can be 1000base-t, 10gbase-t, lag, etc. + For more details on type definition have a look in choices.py in the netbox API implementation in module DCIM. Returns the new interface object as dict. """ device = self.get_device_by_name(device_name) diff --git a/gso/workflows/iptrunk/migrate_iptrunk.py b/gso/workflows/iptrunk/migrate_iptrunk.py index b492606b..a92dc29c 100644 --- a/gso/workflows/iptrunk/migrate_iptrunk.py +++ b/gso/workflows/iptrunk/migrate_iptrunk.py @@ -285,19 +285,6 @@ def deploy_new_isis( } -# Leaving it like this as a placeholder -# @step("Check ISIS metric") -# def check_isis(subscription: Iptrunk, process_id: UUIDstr) -> State: -# provisioning_proxy.check_ip_trunk(subscription, process_id, "VERB NEEDS TO BE UPDATED") -# -# logger.warning("Playbook verb is not yet properly set.") -# -# return { -# "subscription": subscription, -# "label_text": "Checking ISIS functionality, please refresh to get the results of the playbook.", -# } - - @inputstep("Wait for confirmation", assignee=Assignee.SYSTEM) def confirm_continue_restore_isis() -> FormGenerator: class ProvisioningResultPage(FormPage): -- GitLab