trustedanalytics/data-catalog

View on GitHub

Showing 34 of 34 total issues

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

    def _external_delete(self, service_name, token, url, data=None, parameters=None):
Severity: Minor
Found in data_catalog/dataset_delete.py - About 35 mins to fix

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

                if values[1] != -1:
                    time_range['to'] = values[1]
    Severity: Minor
    Found in data_catalog/query_translation.py and 1 other location - About 35 mins to fix
    data_catalog/query_translation.py on lines 283..284

    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 _prepare_query_filters_dict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _prepare_query_filters_dict(query_filters, post_filters, or_filters):
            if not query_filters and or_filters:
                query_filters_dict = {'or': or_filters}
            elif or_filters and query_filters:
                query_filters.append({'or': or_filters})
    Severity: Minor
    Found in data_catalog/query_translation.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 2 locations. Consider refactoring.
    Open

                if values[0] != -1:
                    time_range['from'] = values[0]
    Severity: Minor
    Found in data_catalog/query_translation.py and 1 other location - About 35 mins to fix
    data_catalog/query_translation.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

        if (r.status_code == 200):
            print("indexes deleted")
        else:
            print("problem with delete: ", r.status_code, r.text)
    Severity: Minor
    Found in tools/elastic_migrate_tool.py and 1 other location - About 35 mins to fix
    tools/elastic_migrate_tool.py on lines 80..83

    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

        if (r.status_code == 200):
            print("data inserted")
        else:
            print("problem with insert:", r.status_code, r.text)
    Severity: Minor
    Found in tools/elastic_migrate_tool.py and 1 other location - About 35 mins to fix
    tools/elastic_migrate_tool.py on lines 69..72

    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

                self._elastic_search.update(
                    index=self._config.elastic.elastic_index,
                    doc_type=self._config.elastic.elastic_metadata_type,
    Severity: Minor
    Found in data_catalog/metadata_entry.py and 1 other location - About 30 mins to fix
    data_catalog/metadata_entry.py on lines 171..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 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 None, 503
    Severity: Major
    Found in data_catalog/metadata_entry.py - About 30 mins to fix

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

                  response = self._elastic_search.index(
                      index=self._config.elastic.elastic_index,
                      doc_type=self._config.elastic.elastic_metadata_type,
      Severity: Minor
      Found in data_catalog/metadata_entry.py and 1 other location - About 30 mins to fix
      data_catalog/metadata_entry.py on lines 256..258

      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 []
      Severity: Major
      Found in data_catalog/auth.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return
        Severity: Major
        Found in data_catalog/metadata_entry.py - About 30 mins to fix

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

              def put(self):
                  """
                  Add all data into elastic search. Data that are corrupted are ommited
                  """
                  self._log.info("Adding data to elastic search")
          Severity: Minor
          Found in data_catalog/elastic_admin.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

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

              def get_user_scope(self, token, request, is_admin):
                  requested_orgs = self._get_requested_orgs(request)
                  user_orgs = self._get_orgs_user_has_access(token)
                  self._log.debug('User belongs to orgs: %s/nUser requested access to: %s',
                                  user_orgs, requested_orgs)
          Severity: Minor
          Found in data_catalog/auth.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

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

          def check_license_header(file_path):
              match_found = False
              try:
                  with open(file_path) as checked_file:
                      read_lines = [checked_file.readline() for _ in range(MAX_HEADER_LENGTH)]
          Severity: Minor
          Found in tools/license_checker.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