class AnalyzerDjango

Defined in:

analyzer/analyzers/analyzer_django.cr

Constant Summary

REGEX_INCLUDE_URLS = /include\s*\(\s*r?['"]([^'"\\]*)['"]/
REGEX_ROOT_URLCONF = /\s*ROOT_URLCONF\s*=\s*r?['"]([^'"\\]*)['"]/
REGEX_ROUTE_MAPPING = /(?:url|path|register)\s*\(\s*r?['"]([^"']*)['"][^,]*,\s*([^),]*)/
REQUEST_PARAM_FIELD_MAP = {"GET" => {["GET"], "query"}, "POST" => {["POST"], "form"}, "COOKIES" => {nil, "cookie"}, "META" => {nil, "header"}, "data" => {["POST", "PUT", "PATCH"], "form"}}
REQUEST_PARAM_TYPE_MAP = {"query" => nil, "form" => ["GET", "POST", "PUT", "PATCH"], "cookie" => nil, "header" => nil}

Instance Method Summary

Instance methods inherited from class AnalyzerPython

find_imported_modules(app_base_path : String, file_path : String, content : String | Nil = nil) : Hash(String, Tuple(String, Int32)) find_imported_modules, find_imported_package(package_path : String, dotted_as_names : String) : Array(Tuple(String, String, Int32)) find_imported_package, find_json_params(codeblock_lines : Array(String), json_variable_names : Array(String)) : Array(Param) find_json_params, parse_function_definition(source_lines : Array(String), start_index : Int) : FunctionDefinition | Nil parse_function_definition, parse_function_or_class(data : String | Array(String), after : Regex | Nil = nil) : String | Nil parse_function_or_class, return_literal_value(data : String) : String return_literal_value

Instance methods inherited from class Analyzer

analyze analyze, base_path : String base_path, logger : NoirLogger logger, result : Array(Endpoint) result, url : String url

Constructor methods inherited from class Analyzer

new(options : Hash(String, String)) new

Macros inherited from class Analyzer

define_getter_methods(names) define_getter_methods

Instance Method Detail

def analyze #

[View source]
def get_endpoint_from_files(url : String, filepath : String, function_or_class_name : String) #

[View source]
def get_endpoints(django_urls : DjangoUrls) : Array(Endpoint) #

[View source]
def get_filtered_params(method : String, params : Array(Param)) #

[View source]
def parse_params_in_codeline(line : String, endpoint_methods : Array(String)) #

[View source]
def search_root_django_urls_list : Array(DjangoUrls) #

[View source]