akissa/pysyncthing

View on GitHub

Showing 3 of 11 total issues

SyncthingClient has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

class SyncthingClient(Resource):
    """SyncthingClient class"""

    def __init__(self, api_key, api_url='https://127.0.0.1:8384', **kwargs):
        """Init"""
Severity: Minor
Found in pysyncthing/resource.py - About 4 hrs to fix

    Function _request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _request(self, *args, **kwargs):
            """Make the request"""
            try:
                self.response = self.request(
                    *args, headers=self._request_headers(), **kwargs)
    Severity: Minor
    Found in pysyncthing/resource.py - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function get_readme has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_readme():
        """Generate long description"""
        pandoc = None
        for path in os.environ["PATH"].split(os.pathsep):
            path = path.strip('"')
    Severity: Minor
    Found in setup.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language