The following issues were found

test/mitmproxy/data/addonscripts/load_error.py
2 issues
Missing function or method docstring
Error

Line: 1 Column: 1

              def load(_):
    raise ValueError()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def load(_):
    raise ValueError()

            

Reported by Pylint.

examples/addons/shutdown.py
2 issues
Unable to import 'mitmproxy'
Error

Line: 11 Column: 1

                  and then send a HTTP request to trigger the shutdown:
    curl --proxy localhost:8080 http://example.com/path
"""
from mitmproxy import ctx, http


def request(flow: http.HTTPFlow) -> None:
    # a random condition to make this example a bit more interactive
    if flow.request.pretty_url == "http://example.com/path":

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 1

              from mitmproxy import ctx, http


def request(flow: http.HTTPFlow) -> None:
    # a random condition to make this example a bit more interactive
    if flow.request.pretty_url == "http://example.com/path":
        ctx.log.info("Shutting down everything...")
        ctx.master.shutdown()

            

Reported by Pylint.

test/mitmproxy/data/addonscripts/tcp_stream_modify.py
2 issues
Missing function or method docstring
Error

Line: 1 Column: 1

              def tcp_message(flow):
    message = flow.messages[-1]
    if not message.from_client:
        message.content = message.content.replace(b"foo", b"bar")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              def tcp_message(flow):
    message = flow.messages[-1]
    if not message.from_client:
        message.content = message.content.replace(b"foo", b"bar")

            

Reported by Pylint.

test/mitmproxy/data/addonscripts/same_filename/addon.py
2 issues
Black listed name "foo"
Error

Line: 1 Column: 1

              foo = 42

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              foo = 42

            

Reported by Pylint.

release/hooks/hook-mitmproxy.addons.onboardingapp.py
2 issues
Unable to import 'PyInstaller.utils.hooks'
Error

Line: 1 Column: 1

              from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('mitmproxy.addons.onboardingapp')

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('mitmproxy.addons.onboardingapp')

            

Reported by Pylint.

test/helper_tools/loggrep.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
import fileinput
import sys
import re

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print(f"Usage: {sys.argv[0]} port filenames")
        sys.exit()

            

Reported by Pylint.

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

Line: 12 Column: 5

                      sys.exit()

    port = sys.argv[1]
    matches = False
    for line in fileinput.input(sys.argv[2:]):
        if re.match(r"^\[|(\d+\.){3}", line):
            matches = port in line
        if matches:
            print(line, end="")

            

Reported by Pylint.

release/hooks/hook-mitmproxy.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              hiddenimports = ["mitmproxy.script"]

            

Reported by Pylint.

Module name "hook-mitmproxy" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              hiddenimports = ["mitmproxy.script"]

            

Reported by Pylint.

release/hooks/hook-mitmproxy.tools.web.py
2 issues
Unable to import 'PyInstaller.utils.hooks'
Error

Line: 1 Column: 1

              from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('mitmproxy.tools.web')

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('mitmproxy.tools.web')

            

Reported by Pylint.

mitmproxy/io/__init__.py
2 issues
Unable to import '__init__.io'
Error

Line: 1 Column: 1

              from .io import FlowWriter, FlowReader, FilteredFlowWriter, read_flows_from_paths


__all__ = [
    "FlowWriter", "FlowReader", "FilteredFlowWriter", "read_flows_from_paths"
]

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from .io import FlowWriter, FlowReader, FilteredFlowWriter, read_flows_from_paths


__all__ = [
    "FlowWriter", "FlowReader", "FilteredFlowWriter", "read_flows_from_paths"
]

            

Reported by Pylint.

mitmproxy/net/check.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              import ipaddress
import re

# Allow underscore in host name
# Note: This could be a DNS label, a hostname, a FQDN, or an IP
from typing import AnyStr

_label_valid = re.compile(br"[A-Z\d\-_]{1,63}$", re.IGNORECASE)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 42 Column: 1

                      return False


def is_valid_port(port: int) -> bool:
    return 0 <= port <= 65535

            

Reported by Pylint.