Javakky/NicoApiClient

View on GitHub

Showing 7 of 9 total issues

Function main has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main():
    """一致検索の場合"""
    # フィルタの指定
    view: MatchValue = [100, 1000, 10000]
    mylist: MatchValue = [10, 100]
Severity: Minor
Found in examples/simple_filter.py - About 1 hr to fix

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

        def and_(self, keyword: Union[str, list[str]]) -> "SnapshotSearchAPIV2And":
            """
            AND 検索に利用する。
            NOT 検索に必要なパラメータは `query()` で指定する。
            :param keyword: 検索するキーワード。文字列または文字列を要素に持つリスト。リストにする場合は OR で連結される。
    Severity: Minor
    Found in nicovideo_api_client/api/v2/targets.py - About 45 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 _request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _request(
            self,
            timeout: float,
            total_time: float,
        ) -> Tuple[SnapshotSearchAPIV2Result, float]:
    Severity: Minor
    Found in nicovideo_api_client/api/v2/request.py - About 45 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

    Consider simplifying this complex logical expression.
    Open

            if (
                ((keyword[0] != '"' and keyword[-1] != '"') and " " in keyword)
                or keyword[0] == "-"
                or '"' in keyword
                or "\\" in keyword
    Severity: Major
    Found in nicovideo_api_client/api/v2/targets.py - About 40 mins to fix

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

          def targets(targets: Set[FieldType]) -> SnapshotSearchAPIV2Targets:
              """
              検索対象のフィールドタイプを指定して検索を行う。
      
              :return: クエリ(キーワード)入力オブジェクト
      Severity: Minor
      Found in nicovideo_api_client/api/v2/snapshot_search_api_v2.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

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

          def _arrange_keyword(self, keyword: str, exclude: bool = False):
              """
              キーワードを適切な形でクエリに指定する。
              :param keyword: クエリのqキーに指定するための文字列
              """
      Severity: Minor
      Found in nicovideo_api_client/api/v2/targets.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

      Function request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def request(
              self,
              timeout: float = 400.0,
          ) -> SnapshotSearchAPIV2Result:
              """
      Severity: Minor
      Found in nicovideo_api_client/api/v2/request.py - About 25 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