language

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllLangsLock sync.Mutex

A mutex to protect the AllLanguages and AllLanguagesMap.

View Source
var AllLanguageAggregateStats = LanguageAggregateStats{}

Aggregate stats for all programming languages.

View Source
var AllLanguages []*Language

All programming language types detected by codetalks.

View Source
var AllLanguagesMap = map[string]uint{}

{ language-name: Language-index in AllLanguages list }

Functions

func AggreateStats

func AggreateStats()

Aggregate stats

func AnalyzeAllLanguages

func AnalyzeAllLanguages()

AnalyzeAllLanguages analyzes all code files and accumulates the data.

Types

type Language

type Language struct {
	// Cloc data
	CodeCount    uint32 `json:"code"`
	CommentCount uint32 `json:"comment_count"`
	BlankCount   uint32 `json:"blank_count"`
	TotalLines   uint32 `json:"total_lines"`

	FileCount uint32 `json:"file_count"`
	CodeFiles []*file.CodeFile

	// Language metadata
	Name          string `json:"name"`
	FileExtension string `json:"file_extension"`
}

Language represents a programming language.

func AddLanguage

func AddLanguage(fileExtension string, file *file.CodeFile) *Language

func GetLanguage

func GetLanguage(fileExtension string) *Language

func (*Language) CountCodeFileStats

func (l *Language) CountCodeFileStats(file *file.CodeFile) *Language

CountCodeFileStats counts the code, comment, and blank lines in a code file. It's not thread-safe.

type LanguageAggregateStats

type LanguageAggregateStats struct {
	TotalFiles   uint32 `json:"total_files"`
	TotalLines   uint32 `json:"total_lines"`
	TotalCode    uint32 `json:"total_code"`
	TotalComment uint32 `json:"total_comment"`
	TotalBlank   uint32 `json:"total_blank"`
}

LanguageAggregateStats represents the aggregate statistics of all programming languages.

Jump to

Keyboard shortcuts

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