The following issues were found

certbot/certbot/_internal/plugins/standalone.py
3 issues
Unable to import 'acme'
Error

Line: 15 Column: 1

              
import OpenSSL

from acme import challenges
from acme import standalone as acme_standalone
from certbot import achallenges
from certbot import errors
from certbot import interfaces
from certbot.display import util as display_util

            

Reported by Pylint.

Unable to import 'acme'
Error

Line: 16 Column: 1

              import OpenSSL

from acme import challenges
from acme import standalone as acme_standalone
from certbot import achallenges
from certbot import errors
from certbot import interfaces
from certbot.display import util as display_util
from certbot.plugins import common

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 65
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      :rtype: ACMEServerMixin

        """
        assert challenge_type == challenges.HTTP01
        if port in self._instances:
            return self._instances[port]

        address = (listenaddr, port)
        try:

            

Reported by Bandit.

certbot/certbot/tests/acme_util.py
3 issues
Unable to import 'josepy'
Error

Line: 4 Column: 1

              """ACME utilities for testing."""
import datetime

import josepy as jose

from acme import challenges
from acme import messages
from certbot._internal import auth_handler
from certbot.tests import util

            

Reported by Pylint.

Unable to import 'acme'
Error

Line: 6 Column: 1

              
import josepy as jose

from acme import challenges
from acme import messages
from certbot._internal import auth_handler
from certbot.tests import util

JWK = jose.JWK.load(util.load_vector('rsa512_key.pem'))

            

Reported by Pylint.

Unable to import 'acme'
Error

Line: 7 Column: 1

              import josepy as jose

from acme import challenges
from acme import messages
from certbot._internal import auth_handler
from certbot.tests import util

JWK = jose.JWK.load(util.load_vector('rsa512_key.pem'))
KEY = util.load_rsa_private_key('rsa512_key.pem')

            

Reported by Pylint.

certbot-apache/certbot_apache/_internal/override_fedora.py
3 issues
Unable to import 'certbot'
Error

Line: 2 Column: 1

              """ Distribution specific override class for Fedora 29+ """
from certbot import errors
from certbot import util
from certbot_apache._internal import apache_util
from certbot_apache._internal import configurator
from certbot_apache._internal import parser
from certbot_apache._internal.configurator import OsOptions



            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 3 Column: 1

              """ Distribution specific override class for Fedora 29+ """
from certbot import errors
from certbot import util
from certbot_apache._internal import apache_util
from certbot_apache._internal import configurator
from certbot_apache._internal import parser
from certbot_apache._internal.configurator import OsOptions



            

Reported by Pylint.

Variable name "v" doesn't conform to snake_case naming style
Error

Line: 86 Column: 16

                  def _parse_sysconfig_var(self):
        """ Parses Apache CLI options from Fedora configuration file """
        defines = apache_util.parse_define_file(self.sysconfig_filep, "OPTIONS")
        for k, v in defines.items():
            self.variables[k] = v

            

Reported by Pylint.

acme/tests/util_test.py
3 issues
Unable to import 'acme.util'
Error

Line: 9 Column: 9

                  """Tests for acme.util.map_keys."""

    def test_it(self):
        from acme.util import map_keys
        self.assertEqual({'a': 'b', 'c': 'd'},
                         map_keys({'a': 'b', 'c': 'd'}, lambda key: key))
        self.assertEqual({2: 2, 4: 4}, map_keys({1: 2, 3: 4}, lambda x: x + 1))



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 5

              class MapKeysTest(unittest.TestCase):
    """Tests for acme.util.map_keys."""

    def test_it(self):
        from acme.util import map_keys
        self.assertEqual({'a': 'b', 'c': 'd'},
                         map_keys({'a': 'b', 'c': 'd'}, lambda key: key))
        self.assertEqual({2: 2, 4: 4}, map_keys({1: 2, 3: 4}, lambda x: x + 1))


            

Reported by Pylint.

Import outside toplevel (acme.util.map_keys)
Error

Line: 9 Column: 9

                  """Tests for acme.util.map_keys."""

    def test_it(self):
        from acme.util import map_keys
        self.assertEqual({'a': 'b', 'c': 'd'},
                         map_keys({'a': 'b', 'c': 'd'}, lambda key: key))
        self.assertEqual({2: 2, 4: 4}, map_keys({1: 2, 3: 4}, lambda x: x + 1))



            

Reported by Pylint.

certbot/tests/plugins/null_test.py
3 issues
Unable to import 'certbot._internal.plugins.null'
Error

Line: 14 Column: 9

                  """Tests for certbot._internal.plugins.null.Installer."""

    def setUp(self):
        from certbot._internal.plugins.null import Installer
        self.installer = Installer(config=mock.MagicMock(), name="null")

    def test_it(self):
        self.assertIsInstance(self.installer.more_info(), str)
        self.assertEqual([], self.installer.get_all_names())

            

Reported by Pylint.

Import outside toplevel (certbot._internal.plugins.null.Installer)
Error

Line: 14 Column: 9

                  """Tests for certbot._internal.plugins.null.Installer."""

    def setUp(self):
        from certbot._internal.plugins.null import Installer
        self.installer = Installer(config=mock.MagicMock(), name="null")

    def test_it(self):
        self.assertIsInstance(self.installer.more_info(), str)
        self.assertEqual([], self.installer.get_all_names())

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 5

                      from certbot._internal.plugins.null import Installer
        self.installer = Installer(config=mock.MagicMock(), name="null")

    def test_it(self):
        self.assertIsInstance(self.installer.more_info(), str)
        self.assertEqual([], self.installer.get_all_names())
        self.assertEqual([], self.installer.supported_enhancements())



            

Reported by Pylint.

acme/setup.py
3 issues
Unused import sys
Error

Line: 1 Column: 1

              import sys

from setuptools import find_packages
from setuptools import setup

version = '1.19.0.dev0'

install_requires = [
    # This dependency just exists to ensure that chardet is installed along

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import sys

from setuptools import find_packages
from setuptools import setup

version = '1.19.0.dev0'

install_requires = [
    # This dependency just exists to ensure that chardet is installed along

            

Reported by Pylint.

Constant name "version" doesn't conform to UPPER_CASE naming style
Error

Line: 6 Column: 1

              from setuptools import find_packages
from setuptools import setup

version = '1.19.0.dev0'

install_requires = [
    # This dependency just exists to ensure that chardet is installed along
    # with requests so it will use it instead of charset_normalizer. See
    # https://github.com/certbot/certbot/issues/8964 for more info.

            

Reported by Pylint.

linter_plugin.py
3 issues
Line too long (113/100)
Error

Line: 6 Column: 1

              
The built-in ImportChecker of Pylint does a similar job to ForbidStandardOsModule to detect
deprecated modules. You can check its behavior as a reference to what is coded here.
See https://github.com/PyCQA/pylint/blob/b20a2984c94e2946669d727dbda78735882bf50a/pylint/checkers/imports.py#L287
See https://docs.pytest.org/en/latest/writing_plugins.html
"""
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 36 Column: 5

                  }
    priority = -1

    def visit_import(self, node):
        os_used = any(name for name in node.names if name[0] == 'os' or name[0].startswith('os.'))
        if os_used and not _check_disabled(node):
            self.add_message('os-module-forbidden', node=node)

    def visit_importfrom(self, node):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 41 Column: 5

                      if os_used and not _check_disabled(node):
            self.add_message('os-module-forbidden', node=node)

    def visit_importfrom(self, node):
        if node.modname == 'os' or node.modname.startswith('os.') and not _check_disabled(node):
            self.add_message('os-module-forbidden', node=node)


def register(linter):

            

Reported by Pylint.

windows-installer/setup.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              from setuptools import find_packages
from setuptools import setup

version = '1.0'

setup(
    name='windows-installer',
    version=version,
    description='Environment to build the Certbot Windows installer',

            

Reported by Pylint.

Constant name "version" doesn't conform to UPPER_CASE naming style
Error

Line: 4 Column: 1

              from setuptools import find_packages
from setuptools import setup

version = '1.0'

setup(
    name='windows-installer',
    version=version,
    description='Environment to build the Certbot Windows installer',

            

Reported by Pylint.

certbot-apache/setup.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              from setuptools import find_packages
from setuptools import setup

version = '1.19.0.dev0'

install_requires = [
    # We specify the minimum acme and certbot version as the current plugin
    # version for simplicity. See
    # https://github.com/certbot/certbot/issues/8761 for more info.

            

Reported by Pylint.

Constant name "version" doesn't conform to UPPER_CASE naming style
Error

Line: 4 Column: 1

              from setuptools import find_packages
from setuptools import setup

version = '1.19.0.dev0'

install_requires = [
    # We specify the minimum acme and certbot version as the current plugin
    # version for simplicity. See
    # https://github.com/certbot/certbot/issues/8761 for more info.

            

Reported by Pylint.

certbot/certbot/compat/_path.py
2 issues
Bad option value 'os-module-forbidden'
Error

Line: 16 Column: 1

              # First round of wrapping: we import statically all public attributes exposed by the os.path
# module. This allows in particular to have pylint, mypy, IDEs be aware that most of os.path
# members are available in certbot.compat.path.
from os.path import *  # type: ignore  # pylint: disable=wildcard-import,unused-wildcard-import,os-module-forbidden

# Second round of wrapping: we import dynamically all attributes from the os.path module that have
# not yet been imported by the first round (static star import).
import os.path as std_os_path  # pylint: disable=os-module-forbidden
import sys as std_sys

            

Reported by Pylint.

Bad option value 'os-module-forbidden'
Error

Line: 20 Column: 1

              
# Second round of wrapping: we import dynamically all attributes from the os.path module that have
# not yet been imported by the first round (static star import).
import os.path as std_os_path  # pylint: disable=os-module-forbidden
import sys as std_sys

ourselves = std_sys.modules[__name__]
for attribute in dir(std_os_path):
    # Check if the attribute does not already exist in our module. It could be internal attributes

            

Reported by Pylint.