diff --git a/.github/workflows/lint_code.yaml b/.github/workflows/lint_code.yaml index 79dbac6bdc..56ca0d6b7a 100644 --- a/.github/workflows/lint_code.yaml +++ b/.github/workflows/lint_code.yaml @@ -60,7 +60,7 @@ jobs: - name: Install hatch run: pip install hatch - name: Print Ruff version - run: ruff --version + run: hatch run lint:ruff --version - name: Lint Python run: hatch run lint:all diff --git a/data_safe_haven/administration/users/active_directory_users.py b/data_safe_haven/administration/users/active_directory_users.py index 192cef3549..8a60fe9b40 100644 --- a/data_safe_haven/administration/users/active_directory_users.py +++ b/data_safe_haven/administration/users/active_directory_users.py @@ -77,7 +77,7 @@ def add(self, new_users: Sequence[ResearchUser]) -> None: for line in output.split("\n"): self.logger.parse(line) - def list(self, sre_name: str | None = None) -> Sequence[ResearchUser]: # noqa: A003 + def list(self, sre_name: str | None = None) -> Sequence[ResearchUser]: """List users in a local Active Directory""" list_users_script = FileReader( self.resources_path / "active_directory" / "list_users.ps1" @@ -142,7 +142,7 @@ def remove(self, users: Sequence[ResearchUser]) -> None: for line in output.split("\n"): self.logger.parse(line) - def set(self, users: Sequence[ResearchUser]) -> None: # noqa: A003 + def set(self, users: Sequence[ResearchUser]) -> None: """Set local Active Directory users to specified list""" users_to_remove = [user for user in self.list() if user not in users] self.remove(users_to_remove) diff --git a/data_safe_haven/administration/users/azure_ad_users.py b/data_safe_haven/administration/users/azure_ad_users.py index 15bf9a58c8..33141e9923 100644 --- a/data_safe_haven/administration/users/azure_ad_users.py +++ b/data_safe_haven/administration/users/azure_ad_users.py @@ -56,7 +56,7 @@ def add(self, new_users: Sequence[ResearchUser]) -> None: # # Also add the user to the research users group # self.graph_api.add_user_to_group(user.username, self.researchers_group_name) - def list(self) -> Sequence[ResearchUser]: # noqa: A003 + def list(self) -> Sequence[ResearchUser]: user_list = self.graph_api.read_users() return [ ResearchUser( @@ -105,7 +105,7 @@ def remove(self, users: Sequence[ResearchUser]) -> None: # ) pass - def set(self, users: Sequence[ResearchUser]) -> None: # noqa: A003 + def set(self, users: Sequence[ResearchUser]) -> None: """Set Guacamole users to specified list""" users_to_remove = [user for user in self.list() if user not in users] self.remove(users_to_remove) diff --git a/data_safe_haven/administration/users/guacamole_users.py b/data_safe_haven/administration/users/guacamole_users.py index 6b05a47c54..3df0f0a89f 100644 --- a/data_safe_haven/administration/users/guacamole_users.py +++ b/data_safe_haven/administration/users/guacamole_users.py @@ -30,7 +30,7 @@ def __init__(self, config: Config, sre_name: str, *args: Any, **kwargs: Any): self.sre_name = sre_name self.group_name = f"Data Safe Haven SRE {sre_name} Users" - def list(self) -> Sequence[ResearchUser]: # noqa: A003 + def list(self) -> Sequence[ResearchUser]: """List all Guacamole users""" if self.users_ is None: # Allow for the possibility of an empty list of users postgres_output = self.postgres_provisioner.execute_scripts( diff --git a/data_safe_haven/administration/users/user_handler.py b/data_safe_haven/administration/users/user_handler.py index e51238d160..561b799d36 100644 --- a/data_safe_haven/administration/users/user_handler.py +++ b/data_safe_haven/administration/users/user_handler.py @@ -97,7 +97,7 @@ def get_usernames_guacamole(self, sre_name: str) -> list[str]: self.logger.error(f"Could not load users for SRE '{sre_name}'.") return [] - def list(self) -> None: # noqa: A003 + def list(self) -> None: """List Active Directory, AzureAD and Guacamole users Raises: @@ -157,7 +157,7 @@ def remove(self, user_names: Sequence[str]) -> None: msg = f"Could not remove users: {user_names}.\n{exc}" raise DataSafeHavenUserHandlingError(msg) from exc - def set(self, users_csv_path: str) -> None: # noqa: A003 + def set(self, users_csv_path: str) -> None: """Set AzureAD and Guacamole users Raises: diff --git a/pyproject.toml b/pyproject.toml index 2246f75b88..eba6fee70f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ dependencies = [ "black>=23.1.0", "mypy>=1.0.0", "pydantic>=2.4", - "ruff>=0.0.243", + "ruff>=0.1.0", "types-appdirs>=1.4.3.5", "types-chevron>=0.14.2.5", "types-pytz>=2023.3.0.0",