internal

package
v0.23.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package internal provides internal utilities for the checkapi package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExprToString

func ExprToString(expr ast.Expr) string

ExprToString converts an AST expression to a string representation.

func ReadComponentType

func ReadComponentType(folder string) (string, error)

ReadComponentType reads the component type from the metadata.yaml file in the given folder.

Types

type API

type API struct {
	Values    []string    `json:"values,omitempty"`
	Structs   []APIstruct `json:"structs,omitempty"`
	Functions []Function  `json:"functions,omitempty"`
}

API represents the API of the codebase, including functions and structs.

func Read

func Read(folder string, ignoredFunctions []string, excludedFiles []string) (API, error)

Read reads the Go files in the specified folder and returns an API object.

type APIstruct added in v0.23.0

type APIstruct struct {
	Name   string   `json:"name"`
	Fields []string `json:"fields"`
}

APIstruct represents a struct in the codebase.

type Config

type Config struct {
	IgnoredPaths     []string              `yaml:"ignored_paths"`
	ExcludedFiles    []string              `yaml:"excluded_files"`
	AllowedFunctions []FunctionDescription `yaml:"allowed_functions"`
	IgnoredFunctions []string              `yaml:"ignored_functions"`
	UnkeyedLiteral   UnkeyedLiteral        `yaml:"unkeyed_literal_initialization"`
}

Config represents the configuration for the codebase analysis.

type Function

type Function struct {
	Name        string   `json:"name"`
	Receiver    string   `json:"receiver"`
	ReturnTypes []string `json:"return_types,omitempty"`
	Params      []string `json:"params,omitempty"`
	TypeParams  []string `json:"type_params,omitempty"`
}

Function represents a function in the codebase.

type FunctionDescription

type FunctionDescription struct {
	Classes     []string `yaml:"classes"`
	Name        string   `yaml:"name"`
	Parameters  []string `yaml:"parameters"`
	ReturnTypes []string `yaml:"return_types"`
}

FunctionDescription represents a function description.

type UnkeyedLiteral

type UnkeyedLiteral struct {
	Enabled bool `yaml:"enabled"`
	Limit   int  `yaml:"limit"`
}

UnkeyedLiteral represents the configuration for unkeyed literal initialization.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL