Set up ruff so that test files have at least some linting (#10399)

Alternative implementation for #7908.

In this PR:
- set up ruff in CI (add to `tox.ini`, mark dep in `certbot/setup.py`)
- add a `ruff.toml` that ignores particularly annoying errors. I think
line length isn't actually necessary to set with this workflow since
we're not checking it but putting it there for future usage.
- either fix or ignore the rest of the errors that come with the default
linting configuration. fixed errors are mostly unused variables. ignored
are usually where we're doing weird import things for a specific reason.
This commit is contained in:
ohemorange
2025-08-08 08:48:43 -07:00
committed by GitHub
parent 5859e50e44
commit dea3e5f1c4
26 changed files with 102 additions and 81 deletions
@@ -1245,7 +1245,7 @@ class MultipleVhostsTest(util.ApacheTest):
def test_deploy_cert_no_mod_ssl(self):
# Create
ssl_vhost = self.config.make_vhost_ssl(self.vh_truth[0])
self.config.make_vhost_ssl(self.vh_truth[0])
self.config.parser.modules["socache_shmcb_module"] = None
self.config.prepare_server_https = mock.Mock()
@@ -1,4 +1,5 @@
"""Tests for ApacheConfigurator for AugeasParserNode classes"""
import importlib
import sys
import unittest
from unittest import mock
@@ -7,10 +8,10 @@ import pytest
from certbot_apache._internal.tests import util
try:
import apacheconfig
if importlib.util.find_spec('apacheconfig'):
HAS_APACHECONFIG = True
except ImportError: # pragma: no cover
else: # pragma: no cover
HAS_APACHECONFIG = False
@@ -112,12 +112,12 @@ def test_dummy():
dirty=False,
filepath="/some/random/path"
)
dummydirective = DummyDirectiveNode(
dummydirective = DummyDirectiveNode( # noqa: F841
name="Name",
ancestor=None,
filepath="/another/path"
)
dummycomment = DummyCommentNode(
dummycomment = DummyCommentNode( # noqa: F841
comment="Comment",
ancestor=dummyblock,
filepath="/some/file"