Documentation
¶
Index ¶
- Variables
- func GetAllFiles(paths []string, languages *DefinedLanguages, opts *option.GClocOptions) (map[string]*Language, error)
- func GetFileType(path string, opts *option.GClocOptions) (ext string, ok bool)
- func GetFileTypeByShebang(path string) (shebangLang string, ok bool)
- func GetShebang(line string) (shebangLang string, ok bool)
- type DefinedLanguages
- type GClocLanguage
- type Language
- type Languages
Constants ¶
This section is empty.
Variables ¶
var FileExtensions = map[string]string{}/* 247 elements not displayed */
FileExtensions is the map of file extensions.
Functions ¶
func GetAllFiles ¶
func GetAllFiles(paths []string, languages *DefinedLanguages, opts *option.GClocOptions) (map[string]*Language, error)
GetAllFiles return all the files to be analyzed in paths.
func GetFileType ¶
func GetFileType(path string, opts *option.GClocOptions) (ext string, ok bool)
GetFileType get the file type from the file path.
func GetFileTypeByShebang ¶
GetFileTypeByShebang returns the language from the shebang line.
func GetShebang ¶
GetShebang returns the language from the shebang line.
Types ¶
type DefinedLanguages ¶
DefinedLanguages is the struct for the defined languages.
func NewDefinedLanguages ¶
func NewDefinedLanguages() *DefinedLanguages
func (*DefinedLanguages) GetFormattedString ¶
func (l *DefinedLanguages) GetFormattedString() string
GetFormattedString return DefinedLanguages as a human-readable string.
type GClocLanguage ¶
type GClocLanguage struct { Name string `xml:"name,attr" json:"name,omitempty"` // Name of the language FileCount uint32 `xml:"file_count,attr" json:"file_count"` // Number of files Codes uint32 `xml:"codes,attr" json:"codes"` // Number of lines of code Comments uint32 `xml:"comments,attr" json:"comments"` // Number of lines of comments Blanks uint32 `xml:"blanks,attr" json:"blanks"` // Number of blank lines }
GClocLanguage is provided for xml-cloc and json format.
type Language ¶
type Language struct { Name string LineComments []string RegexLineComments []*regexp.Regexp MultipleLines [][]string Files []string Codes uint32 Comments uint32 Blanks uint32 Total uint32 }
Language is the struct for the language.
func NewLanguage ¶
NewLanguage creates a new language.
func (*Language) AddRegexLineComments ¶
AddRegexLineComments adds the regex line comments.
type Languages ¶
type Languages []Language
Languages is the slice of Language.
func (Languages) SortByBlanks ¶
func (ls Languages) SortByBlanks()
SortByBlanks sorts the languages by blanks. (DESC)
func (Languages) SortByCodes ¶
func (ls Languages) SortByCodes()
SortByCodes sorts the languages by codes. (DESC)
func (Languages) SortByComments ¶
func (ls Languages) SortByComments()
SortByComments sorts the languages by comments. (DESC)
func (Languages) SortByFiles ¶
func (ls Languages) SortByFiles()
SortByFiles sorts the languages by files. (DESC)
func (Languages) SortByName ¶
func (ls Languages) SortByName()
SortByName sorts the languages by name. (ASC)