Documentation ¶
Index ¶
- Variables
- type ClocFile
- type ClocFiles
- type ClocLanguage
- type ClocOptions
- type DefinedLanguages
- type JSONFilesResult
- type JSONLanguagesResult
- type Language
- type Languages
- type Processor
- type Result
- type XMLResult
- type XMLResultFiles
- type XMLResultLanguages
- type XMLResultType
- type XMLTotalFiles
- type XMLTotalLanguages
Constants ¶
This section is empty.
Variables ¶
var Exts = map[string]string{}/* 246 elements not displayed */
Exts is the definition of the language name, keyed by the extension for each language.
Functions ¶
This section is empty.
Types ¶
type ClocFile ¶
type ClocFile struct { Code int32 `xml:"code,attr" json:"code"` Comments int32 `xml:"comment,attr" json:"comment"` Blanks int32 `xml:"blank,attr" json:"blank"` Name string `xml:"name,attr" json:"name"` Lang string `xml:"language,attr" json:"language"` }
ClocFile is collecting to line count result.
func AnalyzeFile ¶
func AnalyzeFile(filename string, language *Language, opts *ClocOptions) *ClocFile
AnalyzeFile is analyzing file, this function calls AnalyzeReader() inside.
func AnalyzeReader ¶
func AnalyzeReader(filename string, language *Language, file io.Reader, opts *ClocOptions) *ClocFile
AnalyzeReader is analyzing file for io.Reader.
type ClocFiles ¶
type ClocFiles []ClocFile
ClocFiles is gocloc result set.
func (ClocFiles) SortByBlanks ¶ added in v0.5.1
func (cf ClocFiles) SortByBlanks()
func (ClocFiles) SortByCode ¶ added in v0.5.1
func (cf ClocFiles) SortByCode()
func (ClocFiles) SortByComments ¶ added in v0.5.1
func (cf ClocFiles) SortByComments()
func (ClocFiles) SortByName ¶ added in v0.5.1
func (cf ClocFiles) SortByName()
type ClocLanguage ¶
type ClocLanguage struct { Name string `xml:"name,attr" json:"name,omitempty"` FilesCount int32 `xml:"files_count,attr" json:"files"` Code int32 `xml:"code,attr" json:"code"` Comments int32 `xml:"comment,attr" json:"comment"` Blanks int32 `xml:"blank,attr" json:"blank"` }
ClocLanguage is provided for xml-cloc and json format.
type ClocOptions ¶
type ClocOptions struct { Debug bool SkipDuplicated bool ExcludeExts map[string]struct{} IncludeLangs map[string]struct{} ReNotMatch *regexp.Regexp ReMatch *regexp.Regexp ReNotMatchDir *regexp.Regexp ReMatchDir *regexp.Regexp Fullpath bool // OnCode is triggered for each line of code. OnCode func(line string) // OnBlack is triggered for each blank line. OnBlank func(line string) // OnComment is triggered for each line of comments. OnComment func(line string) }
ClocOptions is gocloc processor options.
func NewClocOptions ¶
func NewClocOptions() *ClocOptions
NewClocOptions create new ClocOptions with default values.
type DefinedLanguages ¶
DefinedLanguages is the type information for mapping language name(key) and NewLanguage.
func NewDefinedLanguages ¶
func NewDefinedLanguages() *DefinedLanguages
NewDefinedLanguages create DefinedLanguages.
func (*DefinedLanguages) GetFormattedString ¶
func (langs *DefinedLanguages) GetFormattedString() string
GetFormattedString return DefinedLanguages as a human-readable string.
type JSONFilesResult ¶
type JSONFilesResult struct { Files []ClocFile `json:"files"` Total ClocLanguage `json:"total"` }
JSONFilesResult defines the result of the analysis(by files) in JSON format.
func NewJSONFilesResultFromCloc ¶
func NewJSONFilesResultFromCloc(total *Language, sortedFiles ClocFiles) JSONFilesResult
NewJSONFilesResultFromCloc returns JSONFilesResult with default data set.
type JSONLanguagesResult ¶
type JSONLanguagesResult struct { Languages []ClocLanguage `json:"languages"` Total ClocLanguage `json:"total"` }
JSONLanguagesResult defines the result of the analysis in JSON format.
func NewJSONLanguagesResultFromCloc ¶
func NewJSONLanguagesResultFromCloc(total *Language, sortedLanguages Languages) JSONLanguagesResult
NewJSONLanguagesResultFromCloc returns JSONLanguagesResult with default data set.
type Language ¶
type Language struct { Name string Files []string Code int32 Comments int32 Blanks int32 Total int32 // contains filtered or unexported fields }
Language is a type used to definitions and store statistics for one programming language.
func NewLanguage ¶
NewLanguage create language data store.
func (*Language) WithRegexLineComments ¶ added in v0.5.3
type Languages ¶
type Languages []Language
Languages is an array representation of Language.
func (Languages) SortByBlanks ¶ added in v0.5.1
func (ls Languages) SortByBlanks()
func (Languages) SortByCode ¶ added in v0.5.1
func (ls Languages) SortByCode()
func (Languages) SortByComments ¶ added in v0.5.1
func (ls Languages) SortByComments()
func (Languages) SortByFiles ¶ added in v0.5.1
func (ls Languages) SortByFiles()
func (Languages) SortByName ¶ added in v0.5.1
func (ls Languages) SortByName()
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor is gocloc analyzing processor.
func NewProcessor ¶
func NewProcessor(langs *DefinedLanguages, options *ClocOptions) *Processor
NewProcessor returns Processor.
type Result ¶
type Result struct { Total *Language Files map[string]*ClocFile Languages map[string]*Language MaxPathLength int }
Result defined processing result.
type XMLResult ¶
type XMLResult struct { XMLName xml.Name `xml:"results"` XMLFiles *XMLResultFiles `xml:"files,omitempty"` XMLLanguages *XMLResultLanguages `xml:"languages,omitempty"` }
XMLResult stores the results in XML format.
func NewXMLResultFromCloc ¶
func NewXMLResultFromCloc(total *Language, sortedLanguages Languages, _ XMLResultType) *XMLResult
NewXMLResultFromCloc returns XMLResult with default data set.
type XMLResultFiles ¶
type XMLResultFiles struct { Files []ClocFile `xml:"file"` Total XMLTotalFiles `xml:"total"` }
XMLResultFiles stores per file results in XML format.
type XMLResultLanguages ¶
type XMLResultLanguages struct { Languages []ClocLanguage `xml:"language"` Total XMLTotalLanguages `xml:"total"` }
XMLResultLanguages stores the results in XML format.
type XMLResultType ¶
type XMLResultType int8
XMLResultType is the result type in XML format.
const ( // XMLResultWithLangs is the result type for each language in XML format XMLResultWithLangs XMLResultType = iota // XMLResultWithFiles is the result type for each file in XML format XMLResultWithFiles )
type XMLTotalFiles ¶
type XMLTotalFiles struct { Code int32 `xml:"code,attr"` Comment int32 `xml:"comment,attr"` Blank int32 `xml:"blank,attr"` }
XMLTotalFiles is the total result per file in XML format.