jakubroztocil/httpie

View on GitHub

Showing 73 of 73 total issues

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

    def __init__(
Severity: Major
Found in httpie/cli/utils.py - About 50 mins to fix

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

    def find_committers(since: str, until: str) -> FullNames:
        url = f'{REPO_URL}/commits'
        page = 1
        per_page = 100
        params = {
    Severity: Minor
    Found in docs/contributors/fetch.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

    Avoid deeply nested control flow statements.
    Open

                            for line, lf in chain([(line, lf)], iter_lines):
                                body.extend(line)
                                body.extend(lf)
                            self.mime, body = converter.convert(body)
    Severity: Major
    Found in httpie/output/streams.py - About 45 mins to fix

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

      def write_raw_data(
      Severity: Minor
      Found in httpie/output/writer.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if args.all:
                                yield response
                            continue
        Severity: Major
        Found in httpie/client.py - About 45 mins to fix

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

          def find_reporters(since: str, until: str) -> GitHubLogins:
              url = f'{API_URL}/search/issues'
              page = 1
              per_page = 100
              params = {
          Severity: Minor
          Found in docs/contributors/fetch.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 iter_body has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def iter_body(self) -> Iterable[bytes]:
                  # Read the whole body before prettifying it,
                  # but bail out immediately if the body is binary.
                  converter = None
                  body = bytearray()
          Severity: Minor
          Found in httpie/output/streams.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 generate_subparsers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def generate_subparsers(root, parent_parser, definitions, spec):
              action_dest = '_'.join(parent_parser.prog.split()[1:] + ['action'])
              actions = parent_parser.add_subparsers(
                  dest=action_dest
              )
          Severity: Minor
          Found in httpie/manager/cli.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 tokenize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def tokenize(self, s: str) -> List[Union[str, Escaped]]:
                  r"""Tokenize the raw arg string
          
                  There are only two token types - strings and escaped characters:
          
          
          Severity: Minor
          Found in httpie/cli/argtypes.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 fetch_missing_users_details has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def fetch_missing_users_details(people: People) -> None:
              for name, details in people.items():
                  if details['github'] and details['twitter']:
                      continue
                  user_info = user(github_username=details['github'], fullname=name)
          Severity: Minor
          Found in docs/contributors/fetch.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 fix_layout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def fix_layout(session: 'Session', hostname: str, args: argparse.Namespace) -> None:
              if not isinstance(session['cookies'], dict):
                  return None
          
              session['cookies'] = [
          Severity: Minor
          Found in httpie/legacy/v3_1_0_session_cookie_format.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 prepare_request_body has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def prepare_request_body(
          Severity: Minor
          Found in httpie/uploads.py - About 45 mins to fix

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

            def raw_main(
            Severity: Minor
            Found in httpie/core.py - About 35 mins to fix

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

              def _prepare_file_for_upload(
              Severity: Minor
              Found in httpie/uploads.py - About 35 mins to fix

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

                def build_output_stream_for_message(
                Severity: Minor
                Found in httpie/output/writer.py - About 35 mins to fix

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

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

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

                    def write_message(
                    Severity: Minor
                    Found in httpie/output/writer.py - About 35 mins to fix

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

                      def finalize_headers(headers: HTTPHeadersDict) -> HTTPHeadersDict:
                          final_headers = HTTPHeadersDict()
                          for name, value in headers.items():
                              if value is not None:
                                  # “leading or trailing LWS MAY be removed without
                      Severity: Minor
                      Found in httpie/client.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 list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def list(self) -> None:
                              from httpie.plugins.registry import plugin_manager
                      
                              known_plugins = defaultdict(list)
                      
                      
                      Severity: Minor
                      Found in httpie/manager/tasks/plugins.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 _uninstall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _uninstall(self, target: str) -> Optional[ExitStatus]:
                              try:
                                  distribution = importlib_metadata.distribution(target)
                              except importlib_metadata.PackageNotFoundError:
                                  return self.fail('uninstall', target, 'package is not installed')
                      Severity: Minor
                      Found in httpie/manager/tasks/plugins.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