ivanprjcts/sdklib

View on GitHub

Showing 92 of 92 total issues

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

    def patch(
Severity: Minor
Found in sdklib/http/base.py - About 45 mins to fix

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

        def post(
    Severity: Minor
    Found in sdklib/http/base.py - About 45 mins to fix

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

      def request_from_context(context):
          """
          Do http requests from context.
      
          :param context: request context.
      Severity: Minor
      Found in sdklib/http/base.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_url has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def generate_url(scheme=None, host=None, port=None, path=None, query=None):
      Severity: Minor
      Found in sdklib/util/urls.py - About 35 mins to fix

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

            def __init__(self, headers=None, status=None, status_text=None, http_version=None, body=None):
        Severity: Minor
        Found in sdklib/http/response.py - About 35 mins to fix

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

          def log_print_request(method, url, query_params=None, headers=None, body=None):
          Severity: Minor
          Found in sdklib/util/logger.py - About 35 mins to fix

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

            def generate_url_path(
            Severity: Minor
            Found in sdklib/http/base.py - About 35 mins to fix

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

              def unparse(input_dict, output=None, encoding='utf-8', full_document=True,
              Severity: Minor
              Found in sdklib/util/xmltodict.py - About 35 mins to fix

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

                                results.append(
                                    b"=".join([self._encode(key, charset), self._encode(v, charset, output_str)])
                Severity: Minor
                Found in sdklib/http/renderers.py and 2 other locations - About 35 mins to fix
                sdklib/http/renderers.py on lines 263..265
                sdklib/http/renderers.py on lines 270..272

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    @property
                    def code(self):
                        return self.case_insensitive_dict['code'] if "code" in self.case_insensitive_dict else None
                Severity: Minor
                Found in sdklib/http/response.py and 1 other location - About 35 mins to fix
                sdklib/http/response.py on lines 170..173

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                def to_key_val_list(value, sort=False, insensitive=False):
                    """
                    Take an object and test to see if it can be represented as a
                    dictionary. If it can be, return a list of tuples, e.g.,
                    ::
                Severity: Minor
                Found in sdklib/util/structures.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

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

                            for k, vs in to_key_val_dict(data).items():
                                results.append(
                                    b"=".join([self._encode(k, charset), self._encode(vs, charset, output_str)])
                Severity: Minor
                Found in sdklib/http/renderers.py and 2 other locations - About 35 mins to fix
                sdklib/http/renderers.py on lines 263..265
                sdklib/http/renderers.py on lines 285..286

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def apply_authentication(self, context):
                        context.headers[X_11PATHS_DATE_HEADER_NAME] = self.utc or _get_utc()
                        if context.method == POST_METHOD or context.method == PUT_METHOD:
                            if CONTENT_TYPE_HEADER_NAME in context.headers and \
                                    context.headers[CONTENT_TYPE_HEADER_NAME].lower().startswith(
                Severity: Minor
                Found in sdklib/http/authorization.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

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

                                for v in vs:
                                    result.append(
                                        b"=".join([self._encode(k, charset), self._encode(v, charset, output_str)])
                Severity: Minor
                Found in sdklib/http/renderers.py and 2 other locations - About 35 mins to fix
                sdklib/http/renderers.py on lines 270..272
                sdklib/http/renderers.py on lines 285..286

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    @property
                    def message(self):
                        return self.case_insensitive_dict['message'] \
                            if "message" in self.case_insensitive_dict else None
                Severity: Minor
                Found in sdklib/http/response.py and 1 other location - About 35 mins to fix
                sdklib/http/response.py on lines 166..168

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    def patch(
                            self, url_path, headers=None, query_params=None, body_params=None, files=None, **kwargs
                    ):
                        return self._http_request(PATCH_METHOD, url_path, headers, query_params, body_params, files,
                Severity: Minor
                Found in sdklib/http/base.py and 2 other locations - About 30 mins to fix
                sdklib/http/base.py on lines 486..489
                sdklib/http/base.py on lines 492..495

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Avoid too many return statements within this function.
                Open

                            return str(data).encode(charset) if charset else str(data),\
                Severity: Major
                Found in sdklib/http/renderers.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return data, self.content_type
                  Severity: Major
                  Found in sdklib/http/renderers.py - About 30 mins to fix

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

                        @property
                        def entries(self):
                            return [Entry(e) for e in self._dict.get("entries", [])]
                    Severity: Minor
                    Found in sdklib/http/har.py and 2 other locations - About 30 mins to fix
                    sdklib/http/har.py on lines 73..75
                    sdklib/http/har.py on lines 141..143

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 32.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        def post(
                                self, url_path, headers=None, query_params=None, body_params=None, files=None, **kwargs
                        ):
                            return self._http_request(POST_METHOD, url_path, headers, query_params, body_params, files,
                    Severity: Minor
                    Found in sdklib/http/base.py and 2 other locations - About 30 mins to fix
                    sdklib/http/base.py on lines 492..495
                    sdklib/http/base.py on lines 498..501

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 32.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language