mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
staticcheck
This commit is contained in:
parent
055b635fe8
commit
fafdb1336e
@ -41,6 +41,9 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: "Check formatting"
|
name: "Check formatting"
|
||||||
command: diff -u <(echo -n) <(gofmt -d -s .)
|
command: diff -u <(echo -n) <(gofmt -d -s .)
|
||||||
|
- run:
|
||||||
|
name: "staticcheck"
|
||||||
|
command: go get honnef.co/go/tools/cmd/staticcheck && staticcheck ./...
|
||||||
release:
|
release:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:1.15
|
- image: circleci/golang:1.15
|
||||||
|
@ -74,8 +74,8 @@ func ActionRepositoryTags() carapace.Action {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO not yet working - also needs multiple characters to split on `:` `/`
|
|
||||||
func ActionContainerPath() carapace.Action {
|
func ActionContainerPath() carapace.Action {
|
||||||
|
// TODO not yet working - also needs multiple characters to split on `:` `/`
|
||||||
return carapace.ActionMultiParts(":", func(args []string, parts []string) carapace.Action {
|
return carapace.ActionMultiParts(":", func(args []string, parts []string) carapace.Action {
|
||||||
switch len(parts) {
|
switch len(parts) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -184,8 +184,8 @@ func ActionRefs(refOption RefOption) carapace.Action {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO multiparts action to complete step by step
|
|
||||||
func ActionUnstagedChanges() carapace.Action {
|
func ActionUnstagedChanges() carapace.Action {
|
||||||
|
// TODO multiparts action to complete step by step
|
||||||
return carapace.ActionCallback(func(args []string) carapace.Action {
|
return carapace.ActionCallback(func(args []string) carapace.Action {
|
||||||
if output, err := exec.Command("git", "status", "--porcelain").Output(); err != nil {
|
if output, err := exec.Command("git", "status", "--porcelain").Output(); err != nil {
|
||||||
return carapace.ActionMessage(err.Error())
|
return carapace.ActionMessage(err.Error())
|
||||||
|
@ -34,8 +34,8 @@ func init() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO bit hacky as empty delimiter not yet implemented (carapce should support multiple delimiters anyway: []rune)
|
|
||||||
func ActionMode() carapace.Action {
|
func ActionMode() carapace.Action {
|
||||||
|
// TODO bit hacky as empty delimiter not yet implemented (carapce should support multiple delimiters anyway: []rune)
|
||||||
return carapace.ActionMultiParts("", func(args, parts []string) carapace.Action {
|
return carapace.ActionMultiParts("", func(args, parts []string) carapace.Action {
|
||||||
current := carapace.CallbackValue
|
current := carapace.CallbackValue
|
||||||
vals := []string{}
|
vals := []string{}
|
||||||
|
@ -45,9 +45,9 @@ func (a Artifact) Location(repository string) string {
|
|||||||
return fmt.Sprintf("%v/%v/%v/%v/%v-%v.jar", repository, strings.Replace(a.GroupId, ".", "/", -1), a.ArtifactId, a.Version, a.ArtifactId, a.Version)
|
return fmt.Sprintf("%v/%v/%v/%v/%v-%v.jar", repository, strings.Replace(a.GroupId, ".", "/", -1), a.ArtifactId, a.Version, a.ArtifactId, a.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO parent pom plugins
|
|
||||||
// TODO plugins locatad in pluginmanagement and profiles
|
|
||||||
type Project struct {
|
type Project struct {
|
||||||
|
// TODO parent pom plugins
|
||||||
|
// TODO plugins locatad in pluginmanagement and profiles
|
||||||
XMLName xml.Name `xml:"project"`
|
XMLName xml.Name `xml:"project"`
|
||||||
Plugins []Artifact `xml:"build>plugins>plugin"`
|
Plugins []Artifact `xml:"build>plugins>plugin"`
|
||||||
Profiles []string `xml:"profiles>profile>id"`
|
Profiles []string `xml:"profiles>profile>id"`
|
||||||
@ -61,8 +61,8 @@ func repositoryLocation() string {
|
|||||||
return "" // TODO handle error
|
return "" // TODO handle error
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO caching
|
|
||||||
func ActionGoalsAndPhases(file string) carapace.Action {
|
func ActionGoalsAndPhases(file string) carapace.Action {
|
||||||
|
// TODO caching
|
||||||
return carapace.ActionCallback(func(args []string) carapace.Action {
|
return carapace.ActionCallback(func(args []string) carapace.Action {
|
||||||
if project, err := loadProject(file); err != nil {
|
if project, err := loadProject(file); err != nil {
|
||||||
return carapace.ActionMessage(err.Error())
|
return carapace.ActionMessage(err.Error())
|
||||||
@ -188,7 +188,7 @@ func loadPlugin(file string) (plugin *Plugin) {
|
|||||||
if pluginFile, err := f.Open(); err == nil {
|
if pluginFile, err := f.Open(); err == nil {
|
||||||
defer pluginFile.Close()
|
defer pluginFile.Close()
|
||||||
if content, err := ioutil.ReadAll(pluginFile); err == nil {
|
if content, err := ioutil.ReadAll(pluginFile); err == nil {
|
||||||
err = xml.Unmarshal(content, &plugin)
|
_ = xml.Unmarshal(content, &plugin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,9 @@ func ActionDevices(includedDevices IncludedDevices) carapace.Action {
|
|||||||
return carapace.ActionMessage(err.Error())
|
return carapace.ActionMessage(err.Error())
|
||||||
} else {
|
} else {
|
||||||
interfaces := []string{}
|
interfaces := []string{}
|
||||||
|
r := regexp.MustCompile("^[0-9a-zA-Z]")
|
||||||
for _, line := range strings.Split(string(output), "\n") {
|
for _, line := range strings.Split(string(output), "\n") {
|
||||||
if matches, _ := regexp.MatchString("^[0-9a-zA-Z]", line); matches {
|
if matches := r.MatchString(line); matches {
|
||||||
interfaces = append(interfaces, strings.Split(line, ":")[0])
|
interfaces = append(interfaces, strings.Split(line, ":")[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
staticcheck.conf
Normal file
2
staticcheck.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# vi: set ft=toml :
|
||||||
|
checks = ["all", "-ST1000", "-ST1003"]
|
Loading…
x
Reference in New Issue
Block a user