class

Analyzer::Scala::Scalatra

Inherits Analyzer::Scala::ScalaEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object

Constants

CLASS_OBJECT_TRAIT_RE = Regex.union("class", "object", "trait")

Same rationale: replaces the three includes? calls gating the class/object/trait declaration scan in single_mount_prefix.

HTTP_METHODS = ["get", "post", "put", "delete", "patch", "head", "options"] of ::String
ROUTE_PATTERNS = HTTP_METHODS.map do |method| {method, /(?<![.\w])#{method}\s*\(\s*"([^"]+)"/} end

Crystal recompiles an interpolated regex literal on every evaluation (a full PCRE2 JIT compile), and this matcher used to be rebuilt for every verb on every line — precompile the fixed set once at load time.

TEST_PATH_RE = Regex.union("/src/test/", "/src/sbt-test/")

One precompiled Regex.union scan (PCRE2 JIT) replaces two separate String#includes? scans of the same path -- Crystal's includes? is not Boyer-Moore accelerated, so a single regex pass is cheaper than two. Equivalent to the OR-of-substrings it replaces (union escapes each literal).

Class methods

tech_name
Source

Instance methods

analyze
Source
analyze_file(path : String) : Array(Endpoint)
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source