def Declarations.namespace

bend-lint-api@0.2.0.0 · linter/lint.bend:667

import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import Base
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists

667# The namespace of the file at `path`, as the check names it (`found`, once found): "" for Base, or a file the check
668# did not parse.
669def Declarations.namespace(
670  sources: List<&2, Source>,
671  +path: String,
672  found: Maybe<&2, String>
673) -> String:
674  match sources found:
675    case _ Some{namespace}:
676      namespace
677    case Nil{} None{}:
678      ""
679    case Con{Source{p, namespace, text, nodes}, rest} None{}:
680      Declarations.namespace(rest, path, Lists.when(String, String.eq(p, path), namespace))

Uses (6)

Used by (1)