StoryScriptorg/StoryScript

View on GitHub
storyscript/lexer.py

Summary

Maintainability
F
6 days
Test Coverage

File lexer.py has 846 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import numpy as np
# I tried to convince DeepSource that all of the objects existed
from .langData import Exceptions, LambdaExpr, BASE_KEYWORDS, PRIMITIVE_TYPE, Types, mismatch_type, LISTDECLARE_KEYW, PythonFunctionObject, invalid_value, Array, not_enough_args_for_import_statement
from typing import NoReturn
from .langParser import Parser
Severity: Major
Found in storyscript/lexer.py - About 2 days to fix

    Avoid deeply nested control flow statements.
    Open

                            if is_in_else_block:
                                ifstatement["else"] = commands
                            else:
                                ifstatement["if"] = commands
                            is_in_else_block = False
    Severity: Major
    Found in storyscript/lexer.py - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

              return None, None
      Severity: Major
      Found in storyscript/lexer.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return (
        Severity: Major
        Found in storyscript/lexer.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return self.switch_case_statement(tc)
          Severity: Major
          Found in storyscript/lexer.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return len(self.symbol_table.GetVariable(functioncall[0])[1].data), None
            Severity: Major
            Found in storyscript/lexer.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return self.handle_function(functioncall, original_text)
              Severity: Major
              Found in storyscript/lexer.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return None, None
                Severity: Major
                Found in storyscript/lexer.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return self.parse_lambda_expression(tc)
                  Severity: Major
                  Found in storyscript/lexer.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return "NotDefinedException: Undefined argument #1 \"msg\" in string.Trim method call.", Exceptions.NotDefinedException
                    Severity: Major
                    Found in storyscript/lexer.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return None, None
                      Severity: Major
                      Found in storyscript/lexer.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return f'"{res}"', None  # Return the Recieved Input
                        Severity: Major
                        Found in storyscript/lexer.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return res, error
                          Severity: Major
                          Found in storyscript/lexer.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return self.loopfor_statement(tc)
                            Severity: Major
                            Found in storyscript/lexer.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return f"InvalidIndexException: {ie}", Exceptions.InvalidIndexException
                              Severity: Major
                              Found in storyscript/lexer.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                return arguments[0][int(arguments[1]):int(arguments[2])], None
                                Severity: Major
                                Found in storyscript/lexer.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return res, error
                                  Severity: Major
                                  Found in storyscript/lexer.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return invalid_value, Exceptions.InvalidValue
                                    Severity: Major
                                    Found in storyscript/lexer.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return "NotDefinedException: value arguments is required but not defined.", Exceptions.NotDefinedException
                                      Severity: Major
                                      Found in storyscript/lexer.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                        return f"\"{arguments[0]}\"", None
                                        Severity: Major
                                        Found in storyscript/lexer.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                          return res, error
                                          Severity: Major
                                          Found in storyscript/lexer.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                                    return f"InvalidTypeException: Invalid type, Expected {name[0].value} for argument #{argpos}, found {valtype.value}.", Exceptions.InvalidTypeException
                                            Severity: Major
                                            Found in storyscript/lexer.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                                  return f"(Python Exception): {e}", "(Python Exception)"
                                              Severity: Major
                                              Found in storyscript/lexer.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                                    return f"InvalidTypeException: Unknown method mapping type. (Error occurred while scanning method \"{i}\")", Exceptions.InvalidTypeException
                                                Severity: Major
                                                Found in storyscript/lexer.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                              return self.ternary_operator(tc)
                                                  Severity: Major
                                                  Found in storyscript/lexer.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                        return f"InvalidTypeException: Expected argument #1 to be Number, Found {type(argument).__name__}", Exceptions.InvalidTypeException
                                                    Severity: Major
                                                    Found in storyscript/lexer.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                                      return f"\"{msg.strip()}\"", None
                                                      Severity: Major
                                                      Found in storyscript/lexer.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return None, None
                                                        Severity: Major
                                                        Found in storyscript/lexer.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                      return "null", None
                                                          Severity: Major
                                                          Found in storyscript/lexer.py - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                                    return res, error
                                                            Severity: Major
                                                            Found in storyscript/lexer.py - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                              return res, error
                                                              Severity: Major
                                                              Found in storyscript/lexer.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                            return mismatch_type, Exceptions.InvalidValue
                                                                Severity: Major
                                                                Found in storyscript/lexer.py - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                                  return "InvalidOperatorException: You cannot use += with lambda expression, maybe you are looking for Event?", Exceptions.InvalidOperatorException
                                                                  Severity: Major
                                                                  Found in storyscript/lexer.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                            return None, None
                                                                    Severity: Major
                                                                    Found in storyscript/lexer.py - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                                  return self.handle_imports(tc)
                                                                      Severity: Major
                                                                      Found in storyscript/lexer.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                        return value, error
                                                                        Severity: Major
                                                                        Found in storyscript/lexer.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                      return self.handle_array_setting_variable_methods(functioncall, function_name)
                                                                          Severity: Major
                                                                          Found in storyscript/lexer.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                    return None, None
                                                                            Severity: Major
                                                                            Found in storyscript/lexer.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                              return (
                                                                              Severity: Major
                                                                              Found in storyscript/lexer.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                                return "InvalidSyntax: Invalid type", Exceptions.InvalidSyntax
                                                                                Severity: Major
                                                                                Found in storyscript/lexer.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                              return None, None
                                                                                  Severity: Major
                                                                                  Found in storyscript/lexer.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                    return "false", None
                                                                                    Severity: Major
                                                                                    Found in storyscript/lexer.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                                              return f"InvalidTypeException: Expected argument #1 to be Number, Found {type(argument).__name__}", Exceptions.InvalidTypeException
                                                                                      Severity: Major
                                                                                      Found in storyscript/lexer.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                                return res, error
                                                                                        Severity: Major
                                                                                        Found in storyscript/lexer.py - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                          return f"InvalidTypeException: Return value mismatched. Expected {function_object.return_type.value}, found {valtype.value}.", Exceptions.InvalidTypeException
                                                                                          Severity: Major
                                                                                          Found in storyscript/lexer.py - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                        return (
                                                                                            Severity: Major
                                                                                            Found in storyscript/lexer.py - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                                  return f"\"{msg.strip(arguments[1])}\"", None
                                                                                              Severity: Major
                                                                                              Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                            return None, None
                                                                                                Severity: Major
                                                                                                Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                              return res, error
                                                                                                  Severity: Major
                                                                                                  Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                                return res, error
                                                                                                    Severity: Major
                                                                                                    Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                                  return filepath, error
                                                                                                      Severity: Major
                                                                                                      Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                            return f"NotDefinedException: File {filepath} is trying to map methods, but no method mapping dictionary is found.", Exceptions.NotDefinedException
                                                                                                        Severity: Major
                                                                                                        Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                              return "true", None
                                                                                                          Severity: Major
                                                                                                          Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

                                                                                                                        return None, None
                                                                                                            Severity: Major
                                                                                                            Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

                                                                                                                          return self.handle_new_keyword(tc, original_text)
                                                                                                              Severity: Major
                                                                                                              Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

                                                                                                                                return value, error
                                                                                                                Severity: Major
                                                                                                                Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

                                                                                                                              return self.handle_base_keywords(tc, original_text)
                                                                                                                  Severity: Major
                                                                                                                  Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

                                                                                                                                                return (
                                                                                                                    Severity: Major
                                                                                                                    Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

                                                                                                                                      return None, None
                                                                                                                      Severity: Major
                                                                                                                      Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

                                                                                                                                    return f"EXITREQUEST {value}", None
                                                                                                                        Severity: Major
                                                                                                                        Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

                                                                                                                                      return f"InvalidOperatorException: You cannot use {operator}= with lambda expression.", Exceptions.InvalidOperatorException
                                                                                                                          Severity: Major
                                                                                                                          Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

                                                                                                                                            return "InvalidSyntax: Invalid value", Exceptions.InvalidSyntax
                                                                                                                            Severity: Major
                                                                                                                            Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

                                                                                                                                      return (
                                                                                                                              Severity: Major
                                                                                                                              Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

                                                                                                                                                return result, None
                                                                                                                                Severity: Major
                                                                                                                                Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

                                                                                                                                              return f'"{res.value}"', None
                                                                                                                                  Severity: Major
                                                                                                                                  Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                    Open

                                                                                                                                                        return res, None
                                                                                                                                    Severity: Major
                                                                                                                                    Found in storyscript/lexer.py - About 30 mins to fix

                                                                                                                                      There are no issues that match your filters.

                                                                                                                                      Category
                                                                                                                                      Status