mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-05-23 16:40:08 -03:00
common: Use underscore as parameter name for unused parameters
This commit is contained in:
parent
0990c2868d
commit
c9122aad9f
40
common.go
40
common.go
@ -136,9 +136,9 @@ func GetLanguages(filename string, content []byte) []string {
|
|||||||
return languages
|
return languages
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLanguagesByModeline returns a slice of possible languages for the given content, filename will be ignored.
|
// GetLanguagesByModeline returns a slice of possible languages for the given content.
|
||||||
// It complies with the signature to be a Strategy type.
|
// It complies with the signature to be a Strategy type.
|
||||||
func GetLanguagesByModeline(filename string, content []byte, candidates []string) []string {
|
func GetLanguagesByModeline(_ string, content []byte, candidates []string) []string {
|
||||||
headFoot := getHeaderAndFooter(content)
|
headFoot := getHeaderAndFooter(content)
|
||||||
var languages []string
|
var languages []string
|
||||||
for _, getLang := range modelinesFunc {
|
for _, getLang := range modelinesFunc {
|
||||||
@ -196,9 +196,9 @@ var (
|
|||||||
reVimLang = regexp.MustCompile(`(?i:filetype|ft|syntax)\s*=(\w+)(?:\s|:|$)`)
|
reVimLang = regexp.MustCompile(`(?i:filetype|ft|syntax)\s*=(\w+)(?:\s|:|$)`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetLanguagesByEmacsModeline returns a slice of possible languages for the given content, filename and candidates
|
// GetLanguagesByEmacsModeline returns a slice of possible languages for the given content.
|
||||||
// will be ignored. It complies with the signature to be a Strategy type.
|
// It complies with the signature to be a Strategy type.
|
||||||
func GetLanguagesByEmacsModeline(filename string, content []byte, candidates []string) []string {
|
func GetLanguagesByEmacsModeline(_ string, content []byte, _ []string) []string {
|
||||||
matched := reEmacsModeline.FindAllSubmatch(content, -1)
|
matched := reEmacsModeline.FindAllSubmatch(content, -1)
|
||||||
if matched == nil {
|
if matched == nil {
|
||||||
return nil
|
return nil
|
||||||
@ -222,9 +222,9 @@ func GetLanguagesByEmacsModeline(filename string, content []byte, candidates []s
|
|||||||
return []string{language}
|
return []string{language}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLanguagesByVimModeline returns a slice of possible languages for the given content, filename and candidates
|
// GetLanguagesByVimModeline returns a slice of possible languages for the given content.
|
||||||
// will be ignored. It complies with the signature to be a Strategy type.
|
// It complies with the signature to be a Strategy type.
|
||||||
func GetLanguagesByVimModeline(filename string, content []byte, candidates []string) []string {
|
func GetLanguagesByVimModeline(_ string, content []byte, _ []string) []string {
|
||||||
matched := reVimModeline.FindAllSubmatch(content, -1)
|
matched := reVimModeline.FindAllSubmatch(content, -1)
|
||||||
if matched == nil {
|
if matched == nil {
|
||||||
return nil
|
return nil
|
||||||
@ -258,15 +258,15 @@ func GetLanguagesByVimModeline(filename string, content []byte, candidates []str
|
|||||||
return []string{language}
|
return []string{language}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLanguagesByFilename returns a slice of possible languages for the given filename, content and candidates
|
// GetLanguagesByFilename returns a slice of possible languages for the given filename.
|
||||||
// will be ignored. It complies with the signature to be a Strategy type.
|
// It complies with the signature to be a Strategy type.
|
||||||
func GetLanguagesByFilename(filename string, content []byte, candidates []string) []string {
|
func GetLanguagesByFilename(filename string, _ []byte, _ []string) []string {
|
||||||
return data.LanguagesByFilename[filepath.Base(filename)]
|
return data.LanguagesByFilename[filepath.Base(filename)]
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLanguagesByShebang returns a slice of possible languages for the given content, filename and candidates
|
// GetLanguagesByShebang returns a slice of possible languages for the given content.
|
||||||
// will be ignored. It complies with the signature to be a Strategy type.
|
// It complies with the signature to be a Strategy type.
|
||||||
func GetLanguagesByShebang(filename string, content []byte, candidates []string) (languages []string) {
|
func GetLanguagesByShebang(_ string, content []byte, _ []string) (languages []string) {
|
||||||
interpreter := getInterpreter(content)
|
interpreter := getInterpreter(content)
|
||||||
return data.LanguagesByInterpreter[interpreter]
|
return data.LanguagesByInterpreter[interpreter]
|
||||||
}
|
}
|
||||||
@ -346,9 +346,9 @@ func lookForMultilineExec(data []byte) string {
|
|||||||
return interpreter
|
return interpreter
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLanguagesByExtension returns a slice of possible languages for the given filename, content and candidates
|
// GetLanguagesByExtension returns a slice of possible languages for the given filename.
|
||||||
// will be ignored. It complies with the signature to be a Strategy type.
|
// It complies with the signature to be a Strategy type.
|
||||||
func GetLanguagesByExtension(filename string, content []byte, candidates []string) []string {
|
func GetLanguagesByExtension(filename string, _ []byte, _ []string) []string {
|
||||||
if !strings.Contains(filename, ".") {
|
if !strings.Contains(filename, ".") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -377,9 +377,9 @@ func getDotIndexes(filename string) []int {
|
|||||||
return dots
|
return dots
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLanguagesByContent returns a slice of possible languages for the given content, filename and candidates
|
// GetLanguagesByContent returns a slice of possible languages for the given content.
|
||||||
// will be ignored. It complies with the signature to be a Strategy type.
|
// It complies with the signature to be a Strategy type.
|
||||||
func GetLanguagesByContent(filename string, content []byte, candidates []string) []string {
|
func GetLanguagesByContent(filename string, content []byte, _ []string) []string {
|
||||||
ext := strings.ToLower(filepath.Ext(filename))
|
ext := strings.ToLower(filepath.Ext(filename))
|
||||||
fnMatcher, ok := data.ContentMatchers[ext]
|
fnMatcher, ok := data.ContentMatchers[ext]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user