The following issues were found

certbot-nginx/certbot_nginx/_internal/nginxparser.py
5 issues
Variable name "b0" doesn't conform to snake_case naming style
Error

Line: 81 Column: 13

                  def __iter__(self, blocks=None):
        """Iterates the dumped nginx content."""
        blocks = blocks or self.blocks
        for b0 in blocks:
            if isinstance(b0, str):
                yield b0
                continue
            item = copy.deepcopy(b0)
            if spacey(item[0]):

            

Reported by Pylint.

Method could be a function
Error

Line: 132 Column: 5

                              if "#" not in self[:i]:
                    list.__delitem__(self, i)

    def _coerce(self, inbound):
        """
        Coerce some inbound object to be appropriately usable in this object

        :param inbound: string or None or list or UnspacedList
        :returns: (coerced UnspacedList or string or None, spaced equivalent)

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 141 Column: 9

                      :rtype: tuple

        """
        if not isinstance(inbound, list):                      # str or None
            return inbound, inbound
        else:
            if not hasattr(inbound, "spaced"):
                inbound = UnspacedList(inbound)
            return inbound, inbound.spaced

            

Reported by Pylint.

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

Line: 170 Column: 9

                      self.dirty = True

    def __add__(self, other):
        l = copy.deepcopy(self)
        l.extend(other)
        l.dirty = True
        return l

    def pop(self, _i=None):

            

Reported by Pylint.

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

Line: 202 Column: 9

              
    def __deepcopy__(self, memo):
        new_spaced = copy.deepcopy(self.spaced, memo=memo)
        l = UnspacedList(new_spaced)
        l.dirty = self.dirty
        return l

    def is_dirty(self):
        """Recurse through the parse tree to figure out if any sublists are dirty"""

            

Reported by Pylint.

certbot-apache/certbot_apache/_internal/obj.py
5 issues
Unable to import 'certbot.plugins'
Error

Line: 5 Column: 1

              import re
from typing import Set

from certbot.plugins import common


class Addr(common.Addr):
    """Represents an Apache address."""


            

Reported by Pylint.

Unnecessary "elif" after "return"
Error

Line: 43 Column: 9

                      :rtype: int

        """
        if self.get_addr() == "_default_":
            return 0
        elif self.get_addr() == "*":
            return 1
        return 2


            

Reported by Pylint.

Unnecessary "elif" after "return"
Error

Line: 70 Column: 9

                      =========================================  =====

        """
        if self._addr_less_specific(addr):
            return True
        elif self.get_addr() == addr.get_addr():
            if self.is_wildcard() or self.get_port() == addr.get_port():
                return True
        return False

            

Reported by Pylint.

Too many instance attributes (10/7)
Error

Line: 98 Column: 1

                      return self.get_addr_obj(port)


class VirtualHost:
    """Represents an Apache Virtualhost.

    :ivar str filep: file path of VH
    :ivar str path: Augeas path to virtual host
    :ivar set addrs: Virtual Host addresses (:class:`set` of

            

Reported by Pylint.

Too many arguments (11/5)
Error

Line: 123 Column: 5

                  # ?: is used for not returning enclosed characters
    strip_name = re.compile(r"^(?:.+://)?([^ :$]*)")

    def __init__(self, filep, path, addrs, ssl, enabled, name=None,
                 aliases=None, modmacro=False, ancestor=None, node=None):

        """Initialize a VH."""
        self.filep = filep
        self.path = path

            

Reported by Pylint.

certbot-apache/certbot_apache/_internal/override_centos.py
5 issues
Unable to import 'certbot'
Error

Line: 6 Column: 1

              from typing import cast
from typing import List

from certbot import errors
from certbot import util
from certbot.errors import MisconfigurationError
from certbot_apache._internal import apache_util
from certbot_apache._internal import configurator
from certbot_apache._internal import parser

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 7 Column: 1

              from typing import List

from certbot import errors
from certbot import util
from certbot.errors import MisconfigurationError
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.errors'
Error

Line: 8 Column: 1

              
from certbot import errors
from certbot import util
from certbot.errors import MisconfigurationError
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 "m" doesn't conform to snake_case naming style
Error

Line: 102 Column: 13

                      correct_ifmods: List[str] = []
        loadmod_args: List[str] = []
        loadmod_paths: List[str] = []
        for m in loadmods:
            noarg_path = m.rpartition("/")[0]
            path_args = self.parser.get_all_args(noarg_path)
            if loadmod_args:
                if loadmod_args != path_args:
                    msg = ("Certbot encountered multiple LoadModule directives "

            

Reported by Pylint.

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

Line: 176 Column: 16

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

    def not_modssl_ifmodule(self, path):
        """Checks if the provided Augeas path has argument !mod_ssl"""


            

Reported by Pylint.

certbot/setup.py
4 issues
Unused import sys
Error

Line: 5 Column: 1

              from distutils.version import LooseVersion
import os
import re
import sys

from setuptools import __version__ as setuptools_version
from setuptools import find_packages
from setuptools import setup


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import codecs
from distutils.version import LooseVersion
import os
import re
import sys

from setuptools import __version__ as setuptools_version
from setuptools import find_packages
from setuptools import setup

            

Reported by Pylint.

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

Line: 11 Column: 1

              from setuptools import find_packages
from setuptools import setup

min_setuptools_version='39.0.1'
# This conditional isn't necessary, but it provides better error messages to
# people who try to install this package with older versions of setuptools.
if LooseVersion(setuptools_version) < LooseVersion(min_setuptools_version):
    raise RuntimeError(f'setuptools {min_setuptools_version}+ is required')


            

Reported by Pylint.

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

Line: 27 Column: 54

              
def read_file(filename, encoding='utf8'):
    """Read unicode from given file."""
    with codecs.open(filename, encoding=encoding) as fd:
        return fd.read()


here = os.path.abspath(os.path.dirname(__file__))


            

Reported by Pylint.

certbot-apache/certbot_apache/_internal/apacheparser.py
4 issues
Method could be a function
Error

Line: 77 Column: 5

                                  self.metadata == other.metadata)
        return False

    def set_parameters(self, _parameters):  # pragma: no cover
        """Sets the parameters for DirectiveNode"""
        return


class ApacheBlockNode(ApacheDirectiveNode):

            

Reported by Pylint.

Method could be a function
Error

Line: 158 Column: 5

                                                filepath=assertions.PASS,
                                  metadata=self.metadata)]

    def delete_child(self, child):  # pragma: no cover
        """Deletes a ParserNode from the sequence of children"""
        return

    def unsaved_files(self):  # pragma: no cover
        """Returns a list of unsaved filepaths"""

            

Reported by Pylint.

Method could be a function
Error

Line: 162 Column: 5

                      """Deletes a ParserNode from the sequence of children"""
        return

    def unsaved_files(self):  # pragma: no cover
        """Returns a list of unsaved filepaths"""
        return [assertions.PASS]

    def parsed_paths(self):  # pragma: no cover
        """Returns a list of parsed configuration file paths"""

            

Reported by Pylint.

Method could be a function
Error

Line: 166 Column: 5

                      """Returns a list of unsaved filepaths"""
        return [assertions.PASS]

    def parsed_paths(self):  # pragma: no cover
        """Returns a list of parsed configuration file paths"""
        return [assertions.PASS]


interfaces.CommentNode.register(ApacheCommentNode)

            

Reported by Pylint.

certbot-apache/certbot_apache/_internal/display_ops.py
4 issues
Unable to import 'certbot'
Error

Line: 4 Column: 1

              """Contains UI methods for Apache operations."""
import logging

from certbot import errors
from certbot.compat import os
from certbot.display import util as display_util

logger = logging.getLogger(__name__)


            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 5 Column: 1

              import logging

from certbot import errors
from certbot.compat import os
from certbot.display import util as display_util

logger = logging.getLogger(__name__)



            

Reported by Pylint.

Unable to import 'certbot.display'
Error

Line: 6 Column: 1

              
from certbot import errors
from certbot.compat import os
from certbot.display import util as display_util

logger = logging.getLogger(__name__)


def select_vhost_multiple(vhosts):

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 123 Column: 9

                          "vhosts to be explicitly labelled with ServerName or "
            "ServerAlias directives.".format(domain))
        logger.error(msg)
        raise errors.MissingCommandlineFlag(msg)

    return code, tag

            

Reported by Pylint.

certbot/examples/plugins/certbot_example_plugins.py
4 issues
Unable to import 'certbot'
Error

Line: 6 Column: 1

              For full examples, see `certbot.plugins`.

"""
from certbot import interfaces
from certbot.plugins import common


class Authenticator(common.Plugin, interfaces.Authenticator):
    """Example Authenticator."""

            

Reported by Pylint.

Unable to import 'certbot.plugins'
Error

Line: 7 Column: 1

              
"""
from certbot import interfaces
from certbot.plugins import common


class Authenticator(common.Plugin, interfaces.Authenticator):
    """Example Authenticator."""


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 10 Column: 1

              from certbot.plugins import common


class Authenticator(common.Plugin, interfaces.Authenticator):
    """Example Authenticator."""

    description = "Example Authenticator plugin"

    # Implement all methods from Authenticator, remembering to add

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 19 Column: 1

                  # "self" as first argument, e.g. def prepare(self)...


class Installer(common.Plugin, interfaces.Installer):
    """Example Installer."""

    description = "Example Installer plugin"

    # Implement all methods from Installer, remembering to add

            

Reported by Pylint.

certbot/tests/plugins/dns_common_lexicon_test.py
4 issues
Unable to import 'certbot.plugins'
Error

Line: 10 Column: 1

              except ImportError: # pragma: no cover
    from unittest import mock

from certbot.plugins import dns_common_lexicon
from certbot.plugins import dns_test_common_lexicon


class LexiconClientTest(unittest.TestCase, dns_test_common_lexicon.BaseLexiconClientTest):


            

Reported by Pylint.

Unable to import 'certbot.plugins'
Error

Line: 11 Column: 1

                  from unittest import mock

from certbot.plugins import dns_common_lexicon
from certbot.plugins import dns_test_common_lexicon


class LexiconClientTest(unittest.TestCase, dns_test_common_lexicon.BaseLexiconClientTest):

    class _FakeLexiconClient(dns_common_lexicon.LexiconClient):

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

              from certbot.plugins import dns_test_common_lexicon


class LexiconClientTest(unittest.TestCase, dns_test_common_lexicon.BaseLexiconClientTest):

    class _FakeLexiconClient(dns_common_lexicon.LexiconClient):
        pass

    def setUp(self):

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 16 Column: 5

              
class LexiconClientTest(unittest.TestCase, dns_test_common_lexicon.BaseLexiconClientTest):

    class _FakeLexiconClient(dns_common_lexicon.LexiconClient):
        pass

    def setUp(self):
        super().setUp()


            

Reported by Pylint.

certbot-nginx/certbot_nginx/_internal/constants.py
4 issues
XXX TODO: In the future, this could return different constants
Error

Line: 56 Column: 3

              """SHA256 hashes of the contents of all versions of MOD_SSL_CONF_SRC"""

def os_constant(key):
    # XXX TODO: In the future, this could return different constants
    #           based on what OS we are running under.  To see an
    #           approach to how to handle different OSes, see the
    #           apache version of this file.  Currently, we do not
    #           actually have any OS-specific constants on Nginx.
    """

            

Reported by Pylint.

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

Line: 11 Column: 5

              PKGSRC_SERVER_ROOT = "/usr/pkg/etc/nginx"

if platform.system() in ('FreeBSD', 'Darwin'):
    server_root_tmp = FREEBSD_DARWIN_SERVER_ROOT
elif platform.system() in ('NetBSD',):
    server_root_tmp = PKGSRC_SERVER_ROOT
else:
    server_root_tmp = LINUX_SERVER_ROOT


            

Reported by Pylint.

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

Line: 13 Column: 5

              if platform.system() in ('FreeBSD', 'Darwin'):
    server_root_tmp = FREEBSD_DARWIN_SERVER_ROOT
elif platform.system() in ('NetBSD',):
    server_root_tmp = PKGSRC_SERVER_ROOT
else:
    server_root_tmp = LINUX_SERVER_ROOT

CLI_DEFAULTS: Dict[str, Any] = dict(
    server_root=server_root_tmp,

            

Reported by Pylint.

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

Line: 15 Column: 5

              elif platform.system() in ('NetBSD',):
    server_root_tmp = PKGSRC_SERVER_ROOT
else:
    server_root_tmp = LINUX_SERVER_ROOT

CLI_DEFAULTS: Dict[str, Any] = dict(
    server_root=server_root_tmp,
    ctl="nginx",
    sleep_seconds=1

            

Reported by Pylint.

certbot-apache/certbot_apache/_internal/override_debian.py
4 issues
Unable to import 'certbot'
Error

Line: 4 Column: 1

              """ Distribution specific override class for Debian family (Ubuntu/Debian) """
import logging

from certbot import errors
from certbot import util
from certbot.compat import filesystem
from certbot.compat import os
from certbot_apache._internal import apache_util
from certbot_apache._internal import configurator

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 5 Column: 1

              import logging

from certbot import errors
from certbot import util
from certbot.compat import filesystem
from certbot.compat import os
from certbot_apache._internal import apache_util
from certbot_apache._internal import configurator
from certbot_apache._internal.configurator import OsOptions

            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 6 Column: 1

              
from certbot import errors
from certbot import util
from certbot.compat import filesystem
from certbot.compat import os
from certbot_apache._internal import apache_util
from certbot_apache._internal import configurator
from certbot_apache._internal.configurator import OsOptions


            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 7 Column: 1

              from certbot import errors
from certbot import util
from certbot.compat import filesystem
from certbot.compat import os
from certbot_apache._internal import apache_util
from certbot_apache._internal import configurator
from certbot_apache._internal.configurator import OsOptions

logger = logging.getLogger(__name__)

            

Reported by Pylint.