-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Simplifies hookz deleter * Sources can be empty * Fixes error checking, updated devcontainer * updates components * Security fixes and test coverage * version bump
- Loading branch information
Showing
28 changed files
with
275 additions
and
1,370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,70 @@ | ||
{ | ||
"name": "hookz-devcontainer", | ||
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm", | ||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/starship:1": {} | ||
} | ||
"name": "devcontainer-test", | ||
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm", | ||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/starship:1": {}, | ||
"ghcr.io/azutake/devcontainer-features/go-packages-install:0": { | ||
"packages": [ | ||
"github.com/devops-kung-fu/hookz@latest", | ||
"github.com/jandelgado/gcov2lcov@latest", | ||
"github.com/kisielk/errcheck@latest", | ||
"github.com/fzipp/gocyclo/cmd/gocyclo@latest", | ||
"golang.org/x/vuln/cmd/govulncheck@latest", | ||
"honnef.co/go/tools/cmd/staticcheck@latest" | ||
] | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.customGlyphs": true, | ||
"terminal.integrated.fontFamily": "'0xProto Nerd Font', 'Droid Sans Mono', 'monospace', monospace", | ||
"editor.formatOnSave": true, | ||
"go.buildTags": "", | ||
"go.toolsEnvVars": { | ||
"CGO_ENABLED": "0" | ||
}, | ||
"go.useLanguageServer": true, | ||
"go.testEnvVars": { | ||
"CGO_ENABLED": "1" | ||
}, | ||
"go.testFlags": [ | ||
"-v", | ||
"-race" | ||
], | ||
"go.testTimeout": "10s", | ||
"go.coverOnSingleTest": true, | ||
"go.coverOnSingleTestFile": true, | ||
"go.coverOnTestPackage": true, | ||
"go.lintTool": "golangci-lint", | ||
"go.lintOnSave": "package", | ||
"[go]": { | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "always" | ||
} | ||
}, | ||
"markiscodecoverage.coverageThreshold": 95, | ||
"markiscodecoverage.enableOnStartup": true, | ||
"markiscodecoverage.searchCriteria": "*.lcov*" | ||
}, | ||
"extensions": [ | ||
"ms-vscode.go", | ||
"golang.go", | ||
"github.vscode-pull-request-github", | ||
"github.vscode-github-actions", | ||
"aleksandra.go-group-imports", | ||
"oderwat.indent-rainbow", | ||
"yzhang.markdown-all-in-one", | ||
"quicktype.quicktype", | ||
"jebbs.plantuml", | ||
"foxundermoon.shell-format", | ||
"ahebrank.yaml2json", | ||
"amazonwebservices.aws-toolkit-vscode", | ||
"markis.code-coverage", | ||
//"defaltd.go-coverage-viewer", | ||
"Gruntfuggly.todo-tree" // Highlights TODO comments" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "/usr/bin/bash ./.devcontainer/post-create.sh > ~/post-create.log" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mkdir -p $HOME/.local/share/fonts | ||
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/0xProto.zip | ||
unzip 0xProto.zip -d $HOME/.local/share/fonts | ||
rm 0xProto.zip | ||
|
||
starship preset nerd-font-symbols -o ~/.config/starship.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,6 @@ | |
hookz | ||
coverage.out | ||
coverage.html | ||
coverage.lcov | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/devops-kung-fu/common/util" | ||
"github.com/spf13/afero" | ||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/devops-kung-fu/hookz/lib" | ||
) | ||
|
||
func Test_InstallSources(t *testing.T) { | ||
sources := []lib.Source{ | ||
{ | ||
Source: "github.com/devops-kung-fu/hinge@latest", | ||
}, | ||
} | ||
output := util.CaptureOutput(func() { | ||
_ = InstallSources(sources) | ||
}) | ||
|
||
assert.NotNil(t, output) | ||
assert.Contains(t, output, "go install github.com/devops-kung-fu/hinge@latest\n") | ||
|
||
sources = []lib.Source{ | ||
{ | ||
Source: "yeah", | ||
}, | ||
} | ||
output = util.CaptureOutput(func() { | ||
_ = InstallSources(sources) | ||
}) | ||
assert.Contains(t, output, "exit status 1\n") | ||
} | ||
|
||
func TestNoConfig(t *testing.T) { | ||
output := util.CaptureOutput(func() { | ||
NoConfig() | ||
}) | ||
assert.NotNil(t, output) | ||
} | ||
|
||
func TestCheckConfig(t *testing.T) { | ||
|
||
afs := &afero.Afero{Fs: afero.NewMemMapFs()} | ||
|
||
_, err := CheckConfig(afs) | ||
assert.Error(t, err, "There should be no config created so an error should be thrown.") | ||
assert.Equal(t, "NO_CONFIG", err.Error()) | ||
|
||
_ = afs.WriteFile(".hookz.yaml", []byte(""), 0644) | ||
_, err = CheckConfig(afs) | ||
assert.Error(t, err) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.