licenseware/licenseware-sdk-v2

View on GitHub

Showing 168 of 168 total issues

File __init__.py has 847 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'''
# Licenseware SDK

This is the licenseware **Python3** sdk useful for quickly create apps. 
The SDK handles the repetetive actions needed for creating an app (file uploads/validation, background events, api routes and more). 
Severity: Major
Found in licenseware/__init__.py - About 2 days to fix

    File mongodata.py has 520 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    
    Abstraction and validation of inserted data in mongodb
    
    
    
    Severity: Major
    Found in licenseware/mongodata/mongodata.py - About 1 day to fix

      File app_builder.py has 494 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      
      `AppBuilder` is reponsible for creating the Api from the `X_namespace` packages and `X_route` modules. Authenticates the `App` and sends the registration information to registry-service. 
      
      Notice that history report route/path is provided but is not implemented that's because a report must be defined with aggregated data from AnalysisStats mongo collection. 
      Severity: Minor
      Found in licenseware/app_builder/app_builder.py - About 7 hrs to fix

        Function fetch has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
        Open

        def fetch(
            match: Union[dict, Tuple[Dict[str, str], Dict[str, int]]],
            collection: str,
            as_list: bool = True,
            limit: int = None,
        Severity: Minor
        Found in licenseware/mongodata/mongodata.py - About 7 hrs 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

        File file_validators.py has 368 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
        
        Validator for streams of files and files.
        
        
        
        Severity: Minor
        Found in licenseware/common/validators/file_validators.py - About 4 hrs to fix

          File editable_table.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """
          
          EditableTable provided in this package is used to generate table metadata from a marshmallow Schema
          
          
          
          Severity: Minor
          Found in licenseware/editable_table/editable_table.py - About 4 hrs to fix

            File history.py has 334 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import inspect
            import time
            import traceback
            from copy import deepcopy
            from functools import wraps
            Severity: Minor
            Found in licenseware/history/history.py - About 4 hrs to fix

              Function log has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

              def log(
                  *dargs,
                  on_success_save: str = None,
                  on_failure_save: str = None,
                  on_failure_return: Any = None
              Severity: Minor
              Found in licenseware/history/history.py - About 3 hrs 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_value_from_kwargs has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_value_from_kwargs(func_kwargs, *params):
                  for param in params:
                      if func_kwargs.get(param) is not None:
                          return func_kwargs[param]
              
              
              Severity: Minor
              Found in licenseware/history/func.py - About 3 hrs 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 parse_schema has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_schema(self, tag):
              
                      # print("parse_schema", tag)
              
                      payload = {}
              Severity: Minor
              Found in licenseware/cli/test_creator/test_creator.py - About 3 hrs 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

              AppBuilder has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class AppBuilder:
                  def __init__(
                      self,
                      name: str,
                      description: str,
              Severity: Minor
              Found in licenseware/app_builder/app_builder.py - About 3 hrs to fix

                File uploader_encryptor.py has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import os
                import re
                import shutil
                from typing import Dict, List
                
                
                Severity: Minor
                Found in licenseware/uploader_encryptor/uploader_encryptor.py - About 3 hrs to fix

                  Function ma_metadata_to_restx_model has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def ma_metadata_to_restx_model(api: Api, ma_metadata: dict):
                      restx_model = {}
                  
                      for schema_name, mameta in ma_metadata.items():
                  
                  
                  Severity: Minor
                  Found in licenseware/common/marshmallow_restx_converter.py - About 3 hrs 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

                  File report_snapshot.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import random
                  import string
                  import uuid
                  from datetime import datetime
                  from typing import List
                  Severity: Minor
                  Found in licenseware/report_snapshot/report_snapshot.py - About 2 hrs to fix

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

                        def __init__(
                    Severity: Major
                    Found in licenseware/uploader_builder/uploader_builder.py - About 2 hrs to fix

                      MongoRepository has 24 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class MongoRepository(RepositoryInterface):
                          def __init__(
                              self,
                              db_connection: Database,
                              collection: str = None,
                      Severity: Minor
                      Found in licenseware/repository/mongo_repository/mongo_repository.py - About 2 hrs to fix

                        Function recursive_unzip has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def recursive_unzip(file_path: str):
                            """
                            Iterate over an archive and recursively extract all archives using unzip function
                            """
                        
                        
                        Severity: Minor
                        Found in licenseware/utils/file_utils.py - About 2 hrs 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

                        File uploader_builder.py has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        from typing import Callable, Dict, List
                        
                        from flask import Request
                        
                        from licenseware import history
                        Severity: Minor
                        Found in licenseware/uploader_builder/uploader_builder.py - About 2 hrs to fix

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

                              def __init__(
                          Severity: Major
                          Found in licenseware/uploader_validator/uploader_validator.py - About 2 hrs to fix

                            Function extract_headers has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def extract_headers(req_data):
                                # TODO extract security headers
                            
                                headers = {}
                                if req_data.get("parameters"):
                            Severity: Minor
                            Found in licenseware/cli/test_creator/utils.py - About 2 hrs 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