Skip to content

Commit

Permalink
refactoring: godoc format
Browse files Browse the repository at this point in the history
  • Loading branch information
hhatto committed Oct 10, 2021
1 parent 9f27e57 commit ac156d2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"unicode"
)

// ClocFile is collecting to line count result
// ClocFile is collecting to line count result.
type ClocFile struct {
Code int32 `xml:"code,attr" json:"code"`
Comments int32 `xml:"comment,attr" json:"comment"`
Expand All @@ -18,7 +18,7 @@ type ClocFile struct {
Lang string `xml:"language,attr" json:"language"`
}

// ClocFiles is gocloc result set
// ClocFiles is gocloc result set.
type ClocFiles []ClocFile

func (cf ClocFiles) Len() int {
Expand Down
6 changes: 3 additions & 3 deletions gocloc.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package gocloc

// Processor is gocloc analyzing processor
// Processor is gocloc analyzing processor.
type Processor struct {
langs *DefinedLanguages
opts *ClocOptions
}

// Result defined processing result
// Result defined processing result.
type Result struct {
Total *Language
Files map[string]*ClocFile
Languages map[string]*Language
MaxPathLength int
}

// NewProcessor returns Processor
// NewProcessor returns Processor.
func NewProcessor(langs *DefinedLanguages, options *ClocOptions) *Processor {
return &Processor{
langs: langs,
Expand Down
8 changes: 4 additions & 4 deletions json.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package gocloc

// JSONLanguagesResult defines the result of the analysis in JSON format
// JSONLanguagesResult defines the result of the analysis in JSON format.
type JSONLanguagesResult struct {
Languages []ClocLanguage `json:"languages"`
Total ClocLanguage `json:"total"`
}

// JSONFilesResult defines the result of the analysis(by files) in JSON format
// JSONFilesResult defines the result of the analysis(by files) in JSON format.
type JSONFilesResult struct {
Files []ClocFile `json:"files"`
Total ClocLanguage `json:"total"`
}

// NewJSONLanguagesResultFromCloc returns JSONLanguagesResult with default data set
// NewJSONLanguagesResultFromCloc returns JSONLanguagesResult with default data set.
func NewJSONLanguagesResultFromCloc(total *Language, sortedLanguages Languages) JSONLanguagesResult {
var langs []ClocLanguage
for _, language := range sortedLanguages {
Expand All @@ -38,7 +38,7 @@ func NewJSONLanguagesResultFromCloc(total *Language, sortedLanguages Languages)
}
}

// NewJSONFilesResultFromCloc returns JSONFilesResult with default data set
// NewJSONFilesResultFromCloc returns JSONFilesResult with default data set.
func NewJSONFilesResultFromCloc(total *Language, sortedFiles ClocFiles) JSONFilesResult {
t := ClocLanguage{
FilesCount: total.Total,
Expand Down
6 changes: 3 additions & 3 deletions language.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
enry "github.com/go-enry/go-enry/v2"
)

// ClocLanguage is provide for xml-cloc and json format
// ClocLanguage is provide for xml-cloc and json format.
type ClocLanguage struct {
Name string `xml:"name,attr" json:"name,omitempty"`
FilesCount int32 `xml:"files_count,attr" json:"files"`
Expand Down Expand Up @@ -377,7 +377,7 @@ func getFileType(path string, opts *ClocOptions) (ext string, ok bool) {
return ext, ok
}

// NewLanguage create language data store
// NewLanguage create language data store.
func NewLanguage(name string, lineComments []string, multiLines [][]string) *Language {
return &Language{
Name: name,
Expand Down Expand Up @@ -428,7 +428,7 @@ func (langs *DefinedLanguages) GetFormattedString() string {
return buf.String()
}

// NewDefinedLanguages create DefinedLanguages
// NewDefinedLanguages create DefinedLanguages.
func NewDefinedLanguages() *DefinedLanguages {
return &DefinedLanguages{
Langs: map[string]*Language{
Expand Down
4 changes: 2 additions & 2 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package gocloc

import "regexp"

// ClocOptions is gocloc processor options
// ClocOptions is gocloc processor options.
type ClocOptions struct {
Debug bool
SkipDuplicated bool
Expand All @@ -19,7 +19,7 @@ type ClocOptions struct {
OnComment func(line string)
}

// NewClocOptions create new ClocOptions with default values
// NewClocOptions create new ClocOptions with default values.
func NewClocOptions() *ClocOptions {
return &ClocOptions{
Debug: false,
Expand Down

0 comments on commit ac156d2

Please sign in to comment.