Documentation
¶
Index ¶
- Constants
- func AddLineNumberAndCharInLineToPositions(theFile []byte, positions []*Position)
- func AddLineNumberAndCharInLineToSnippets(theFile []byte, snippets []*Snippet)
- func ByComponent(snippet *Snippet) string
- func ByDirectory(snippet *Snippet) string
- func ByFile(snippet *Snippet) string
- func ByType(s *Snippet) string
- func MultiGroupSnippetsBy(snippets []*Snippet, groupBys map[string]GroupSnippetByFunc) map[string]SnippetGroup
- type File
- type GroupSnippetByFunc
- type Position
- type Results
- type Snippet
- type SnippetGroup
- type StatRecord
- type Stats
- type StatsGroup
Constants ¶
View Source
const ( ComponentDeclaration = "modularity__component__declarations" ComponentImport = "modularity__component__imports" AbstractType = "modularity__types__abstract" Type = "modularity__types__total" FileCount = "complexity__files" )
Variables ¶
This section is empty.
Functions ¶
func ByComponent ¶
func ByDirectory ¶
func MultiGroupSnippetsBy ¶
func MultiGroupSnippetsBy(snippets []*Snippet, groupBys map[string]GroupSnippetByFunc) map[string]SnippetGroup
Types ¶
type GroupSnippetByFunc ¶
type Position ¶
type Position struct {
// The offset in the file
Offset int
// The line number in the file. This value is not always available, and is calculated from the offset.
Line int
// The character position in the line. This value is not always available, and is calculated from the offset.
CharInLine int
}
Position in a file. Only the offset is required.
type Results ¶
type Results struct {
Directory string
Component string
Name string
Stats []*StatRecord
Snippets []*Snippet
}
type Snippet ¶
type Snippet struct {
File string `json:"file"`
Directory string `json:"directory"`
Component string `json:"component"`
Type string `json:"type"`
Begin *Position `json:"begin"`
End *Position `json:"end"`
Value string `json:"Value"`
}
A Snippet is a piece of text that is extracted from a file. Snippets are used to generate Stats for a code base. Snippets can have several types, for example "function" or "class".
type SnippetGroup ¶
type StatRecord ¶
type StatRecord struct {
StatType string
Value interface{}
}
func SnippetsToStats ¶
func SnippetsToStats(snippets []*Snippet) []*StatRecord
type Stats ¶
type Stats map[string]interface{}
Stats are a map of stat type to value For example: {"function": 10, "class": 5} These stats are usually the number of Snippet of a certain type Stats can also be generated by a StatProvider
type StatsGroup ¶
StatsGroup is a mapping of a name to a Stats
func (StatsGroup) SetStat ¶
func (s StatsGroup) SetStat(key, stat string, value interface{})
Click to show internal directories.
Click to hide internal directories.