rlsbl v0.60.1 /rlsbl.lint.go_ast
On this page

Go linter using tree-sitter AST parsing to detect library boundary violations including forbidden imports and stdout/logging usage.

#rlsbl.lint.go_ast

#rlsbl.lint.go_ast

Go linter using tree-sitter AST parsing to detect library boundary violations including forbidden imports and stdout/logging usage.

#_node_line

python
def _node_line(node)

Return 1-based line number for a tree-sitter node.

#_check_forbidden_imports

python
def _check_forbidden_imports(tree, filepath, config)

Walk AST for import_declaration nodes (single and grouped).

#_extract_string_content

python
def _extract_string_content(string_node)

Extract the text content from an interpreted_string_literal node.

#_check_stdout

python
def _check_stdout(tree, filepath, config)

Detect fmt.Print, fmt.Fprint to os.Stdout, and os.Stdout.Write() calls.

#_check_entry_points

python
def _check_entry_points(tree, filepath, config)

Detect func main() in package main files.

#scan_imports

python
def scan_imports(filepath: str) -> list[tuple[str, str, int]]

Extract all import paths from a Go source file.

Parses the file with tree-sitter and walks import_declaration nodes to collect every imported package path.

Args:

  • filepath: absolute path to a .go file.

Returns:

  • list of (import_path, filepath, line_number) tuples.

#GoAstLinter

Go linter using tree-sitter AST analysis.

#lint

python
def lint(self, project_path: str, config: LanguageLintConfig) -> list[LintResult]