prkumar/uplink

View on GitHub

Showing 22 of 34 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def __eq__(self, other):
return (
isinstance(other, AfterException)
and self.request == other.request
and self.exc_type == other.exc_type
Severity: Major
Found in uplink/clients/io/state.py and 1 other location - About 3 hrs to fix
uplink/clients/io/state.py on lines 201..207

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def __eq__(self, other):
return (
isinstance(other, Fail)
and self.request == other.request
and self.exc_type == other.exc_type
Severity: Major
Found in uplink/clients/io/state.py and 1 other location - About 3 hrs to fix
uplink/clients/io/state.py on lines 157..163

File interfaces.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Local imports
from uplink import compat
 
 
class IllegalRequestStateTransition(RuntimeError):
Severity: Minor
Found in uplink/clients/io/interfaces.py - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class dumps(_ModelConverterBuilder):
    """
    Builds a custom object serializer.
     
    This decorator takes a single argument, the base model class, and
    Severity: Major
    Found in uplink/models.py and 1 other location - About 1 hr to fix
    uplink/models.py on lines 91..146

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class loads(_ModelConverterBuilder):
    """
    Builds a custom object deserializer.
     
    This class takes a single argument, the base model class, and
    Severity: Major
    Found in uplink/models.py and 1 other location - About 1 hr to fix
    uplink/models.py on lines 150..206

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def __init__(self, request, exc_type, exc_val, exc_tb):
    super().__init__(request)
    self._exc_type = exc_type
    self._exc_val = exc_val
    self._exc_tb = exc_tb
    Severity: Major
    Found in uplink/clients/io/state.py and 1 other location - About 1 hr to fix
    uplink/clients/io/state.py on lines 134..138

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def __init__(self, request, exc_type, exc_val, exc_tb):
    super().__init__(request)
    self._exc_type = exc_type
    self._exc_val = exc_val
    self._exc_tb = exc_tb
    Severity: Major
    Found in uplink/clients/io/state.py and 1 other location - About 1 hr to fix
    uplink/clients/io/state.py on lines 180..184

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    def __eq__(self, other):
    return (
    isinstance(other, Sleep)
    and self.request == other.request
    and self.duration == other.duration
    Severity: Major
    Found in uplink/clients/io/state.py and 2 other locations - About 1 hr to fix
    uplink/clients/io/state.py on lines 125..129
    uplink/clients/io/state.py on lines 223..227

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    def __eq__(self, other):
    return (
    isinstance(other, AfterResponse)
    and self.request == other.request
    and self.response == other.response
    Severity: Major
    Found in uplink/clients/io/state.py and 2 other locations - About 1 hr to fix
    uplink/clients/io/state.py on lines 73..77
    uplink/clients/io/state.py on lines 223..227

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    def __eq__(self, other):
    return (
    isinstance(other, Finish)
    and self.request == other.request
    and self.response == other.response
    Severity: Major
    Found in uplink/clients/io/state.py and 2 other locations - About 1 hr to fix
    uplink/clients/io/state.py on lines 73..77
    uplink/clients/io/state.py on lines 125..129

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def create_request_body_converter(self, type_, *args, **kwargs):
    if is_subclass(type_, pydantic.BaseModel):
    return self._make_converter(_PydanticV2RequestBody, type_)
    return self._make_converter(_PydanticV1RequestBody, type_)
    Severity: Major
    Found in uplink/converters/pydantic_.py and 1 other location - About 1 hr to fix
    uplink/converters/pydantic_.py on lines 71..74

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def create_response_body_converter(self, type_, *args, **kwargs):
    if is_subclass(type_, pydantic.BaseModel):
    return self._make_converter(_PydanticV2ResponseBody, type_)
    return self._make_converter(_PydanticV1ResponseBody, type_)
    Severity: Major
    Found in uplink/converters/pydantic_.py and 1 other location - About 1 hr to fix
    uplink/converters/pydantic_.py on lines 66..69

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

    def users_for_keyword():
    """
    /users?keyword=<keyword>[?oldest-age=<age in weeks>]
     
    Find the top users who have commited in repositories matching the keyword in the last month"""
    Severity: Minor
    Found in examples/github-api/Server.py - About 55 mins to fix

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

    def get_call_args(f, *args, **kwargs):
    sig = signature(f)
    arguments = sig.bind(*args, **kwargs).arguments
    # apply defaults:
    new_arguments = []
    Severity: Minor
    Found in uplink/utils.py - About 55 mins to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def on_failure(self, exc_type, exc_val, exc_tb):
    self._context.state = AfterException(
    self._request, exc_type, exc_val, exc_tb
    )
    return self._context.execute()
    Severity: Minor
    Found in uplink/clients/io/state.py and 1 other location - About 50 mins to fix
    uplink/clients/io/state.py on lines 94..98

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def on_failure(self, exc_type, exc_val, exc_tb):
    self._context.state = AfterException(
    self._request, exc_type, exc_val, exc_tb
    )
    return self._context.execute()
    Severity: Minor
    Found in uplink/clients/io/state.py and 1 other location - About 50 mins to fix
    uplink/clients/io/state.py on lines 52..56

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def __init__(
    Severity: Minor
    Found in uplink/builder.py - About 45 mins to fix

      Function _encode_pydantic_v1 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def _encode_pydantic_v1(obj: Any) -> Any:
      from pydantic.v1.json import pydantic_encoder
       
      # json atoms
      if isinstance(obj, str | int | float | bool) or obj is None:
      Severity: Minor
      Found in uplink/converters/pydantic_v1.py - About 45 mins to fix

      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def __init__(
      Severity: Minor
      Found in uplink/commands.py - About 35 mins to fix

        Function commits_for_repo has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def commits_for_repo(
        Severity: Minor
        Found in examples/github-api/Server.py - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language