Skip to content

Commit

Permalink
Add badges, fix some Go Report Card issues (#364)
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Szostok <[email protected]>
  • Loading branch information
Trojan295 and mszostok authored Jun 30, 2021
1 parent 55cffff commit fb89c95
Show file tree
Hide file tree
Showing 111 changed files with 503 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/branch-build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Default branch build
name: Main branch

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ linters:
- typecheck
- unused
- varcheck
- golint
- revive
- gofmt
- misspell
- gochecknoinits
- unparam
- scopelint
- exportloopref
- gosec
- goimports
- whitespace
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Capact

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![GitHub Actions main branch CI](https://github.com/capactio/capact/actions/workflows/branch-build.yaml/badge.svg?branch=main)](https://github.com/capactio/capact/actions/workflows/branch-build.yaml?query=branch%3Amain)
[![Go Report Card](https://goreportcard.com/badge/github.com/capactio/capact)](https://goreportcard.com/report/github.com/capactio/capact)

**Capact** (pronounced: "cape-act", /ˈkeɪp.ækt/) is a simple way to manage applications and infrastructure.

> **⚠️ WARNING**: Capact versions prior to 0.4.0 are considered experimental. Capact 0.4.0, the very first public Capact release, is coming very soon, along with the **capact.io** website going live. Until this moment, the links may not work properly. Stay tuned for the announcement!
Expand Down
1 change: 1 addition & 0 deletions cmd/argo-actions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"go.uber.org/zap"
)

// Config for the argo-actions command.
type Config struct {
Action string
DownloadConfig []argoactions.DownloadConfig `envconfig:"optional"`
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var argoHiddenFlags = []string{
"node-field-selector",
}

// NewCmd returns a new cobra.Command subcommand for Action related operations.
func NewCmd() *cobra.Command {
root := &cobra.Command{
Use: "action",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/action/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"
)

// NewCreate returns a new cobra.Command for creating a new Action.
func NewCreate() *cobra.Command {
var opts action.CreateOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/action/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
)

// NewDelete returns a new cobra.Command for deleting an Action.
func NewDelete() *cobra.Command {
var opts action.DeleteOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/action/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/spf13/cobra"
)

// NewGet returns a cobra.Command for getting Actions.
func NewGet() *cobra.Command {
var opts action.GetOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/action/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
)

// NewRun returns a new cobra.Command for running rendered Actions.
func NewRun() *cobra.Command {
var opts action.RunOptions

Expand Down
2 changes: 2 additions & 0 deletions cmd/cli/cmd/action/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/spf13/cobra"
)

// NewWatch returns a cobra.Command for watching of runnning Actions.
// It uses the command from "argo watch".
func NewWatch() *cobra.Command {
cmd := commands.NewWatchCommand()
cmd.Use = "watch ACTION"
Expand Down
2 changes: 2 additions & 0 deletions cmd/cli/cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/spf13/cobra"
)

// NewCompletion returns a cobra.Command for shell autocompletion generation.
// Supported shells: bash, zsh, fish, powershell
func NewCompletion() *cobra.Command {
cmd := &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/spf13/cobra"
)

// NewCmd returns a cobra.Command for CLI configuration related operations.
// TODO: Add support for target configuration (instead of relying on current default context in kubectl)
func NewCmd() *cobra.Command {
cmd := &cobra.Command{
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/config/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/spf13/cobra"
)

// NewGet returns a cobra.Command for getting the available Capact contexts.
func NewGet() *cobra.Command {
return &cobra.Command{
Use: "get-contexts",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/config/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type setContextOptions struct {
serverAddress string
}

// NewSet returns a cobra.Command for setting an active CLI context.
func NewSet() *cobra.Command {
var opts setContextOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ title: %s
`
)

// NewDocs returns a cobra.Command for generating Capact CLI documentation.
func NewDocs() *cobra.Command {
return &cobra.Command{
Use: "gen-usage-docs",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/hub/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
)

// NewCmd returns a cobra.Command for interacting with the Hub.
func NewCmd() *cobra.Command {
hub := &cobra.Command{
Use: "hub",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/hub/implementations/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type getOptions struct {
implementationPaths []string
}

// NewGet returns a cobra.Command for getting Implementations from a Public Hub.
func NewGet() *cobra.Command {
var opts getOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/hub/implementations/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/spf13/cobra"
)

// NewImplementations returns a cobra.Command for Hub Implementation related operations.
func NewImplementations() *cobra.Command {
cmd := &cobra.Command{
Use: "implementations",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/hub/interfaces/browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type browseOptions struct {
pathPattern string
}

// NewBrowse returns a cobra.Command for browsing available Interfaces in a Public Hub.
func NewBrowse() *cobra.Command {
var opts browseOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/hub/interfaces/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var (
allPathPrefix = "cap.interface.*"
)

// NewGet returns a cobra.Command for getting available Implementations in a Public Hub.
func NewGet() *cobra.Command {
var opts getOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/hub/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/spf13/cobra"
)

// NewInterfaces returns a cobra.Command for Hub Interfaces related operations.
func NewInterfaces() *cobra.Command {
cmd := &cobra.Command{
Use: "interfaces",
Expand Down
3 changes: 1 addition & 2 deletions cmd/cli/cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ type loginOptions struct {
password string
}

// TODO: Validate the Gateway Hub URL

// NewLogin returns a cobra.Command for logging into a Hub.
func NewLogin() *cobra.Command {
var opts loginOptions

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/spf13/cobra"
)

// NewLogout returns a cobra.Command for logout from a Hub.
func NewLogout() *cobra.Command {
cmd := &cobra.Command{
Use: "logout [SERVER]",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/policy/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"
)

// NewApply returns a cobra.Command for applying Capact Global policy on a Capact environment.
func NewApply() *cobra.Command {
var opts policy.ApplyOptions

Expand Down
2 changes: 2 additions & 0 deletions cmd/cli/cmd/policy/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/spf13/cobra"
)

// NewEdit returns a cobra.Command for interactive editing
// of Capact Global policy on a Capact environment.
func NewEdit() *cobra.Command {
cmd := &cobra.Command{
Use: "edit",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/policy/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"
)

// NewGet return a cobra.Command for getting the Capact Global policy on a Capact environment.
func NewGet() *cobra.Command {
resourcePrinter := printer.NewForResource(os.Stdout, printer.WithJSON(), printer.WithYAML(), printer.WithDefaultOutputFormat(printer.YAMLFormat))

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package policy

import "github.com/spf13/cobra"

// NewCmd returns a cobra.Command for policy related operations.
func NewCmd() *cobra.Command {
root := &cobra.Command{
Use: "policy",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var (
configPath string
)

// NewRoot returns a root cobra.Command for the whole Capact CLI.
func NewRoot() *cobra.Command {
rootCmd := &cobra.Command{
Use: cli.Name,
Expand Down
4 changes: 3 additions & 1 deletion cmd/cli/cmd/typeinstance/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"

"capact.io/capact/internal/cli"
"capact.io/capact/internal/cli/client"
Expand All @@ -23,6 +24,7 @@ type applyOptions struct {
TypeInstancesFiles []string
}

// NewApply returns a cobra.Command for applying a TypeInstance on a Local Hub.
func NewApply() *cobra.Command {
var opts applyOptions

Expand Down Expand Up @@ -95,7 +97,7 @@ func typeInstancesFromFile(typeInstancesFiles []string) ([]gqllocalapi.UpdateTyp
}

func loadUpdateTypeInstanceFromFile(path string) ([]gqllocalapi.UpdateTypeInstancesInput, error) {
f, err := os.Open(path)
f, err := os.Open(filepath.Clean(path))
if err != nil {
return nil, errors.Wrap(err, "cannot open file with TypeInstance input")
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/cli/cmd/typeinstance/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"

"capact.io/capact/internal/cli"
"capact.io/capact/internal/cli/client"
Expand All @@ -23,6 +24,7 @@ type createOptions struct {
TypeInstancesFiles []string
}

// NewCreate returns a cobra.Command for creating a TypeInstance on a Local Hub.
func NewCreate() *cobra.Command {
var opts createOptions

Expand Down Expand Up @@ -112,7 +114,7 @@ func createTI(ctx context.Context, opts createOptions, resourcePrinter *printer.
}

func loadCreateTypeInstanceFromFile(path string) (*gqllocalapi.CreateTypeInstancesInput, error) {
f, err := os.Open(path)
f, err := os.Open(filepath.Clean(path))
if err != nil {
return nil, errors.Wrap(err, "cannot open file with TypeInstance input")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/typeinstance/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/spf13/cobra"
)

// NewDelete returns a cobra.Command for deleting a TypeInstance on a Local Hub.
func NewDelete() *cobra.Command {
cmd := &cobra.Command{
Use: "delete TYPE_INSTANCE_ID...",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/typeinstance/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type editOptions struct {
EditTypeInstanceID string
}

// NewEdit returns a cobra.Command for editing a TypeInstance on a Local Hub.
func NewEdit() *cobra.Command {
var opts editOptions

Expand Down
4 changes: 4 additions & 0 deletions cmd/cli/cmd/typeinstance/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ import (

const yamlFileSeparator = "---"

// GetOptions is used to store the configuration flags for the Get command.
type GetOptions struct {
RequestedTypeInstancesIDs []string
ExportToUpdateFormat bool
}

// ErrTableFormatWithExportFlag is used to inform that --export flag was used with table output,
// which is not supported.
var ErrTableFormatWithExportFlag = fmt.Errorf("cannot use --export with table output")

// NewGet returns a cobra.Command for getting TypeInstances on a Local Hub.
func NewGet() *cobra.Command {
var opts GetOptions
out := os.Stdout
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/typeinstance/type_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
decodeBufferSize = 4096
)

// NewCmd returns a cobra.Command for TypeInstance related operations.
func NewCmd() *cobra.Command {
root := &cobra.Command{
Use: "typeinstance",
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
)

// NewUpgrade returns a cobra.Command for upgrading a Capact environment.
func NewUpgrade() *cobra.Command {
var opts upgrade.Options

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/spf13/cobra"
)

// NewValidate returns a cobra.Command for validating Hub Manifests.
func NewValidate() *cobra.Command {
schemaProvider := schema.Provider{}

Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var (
`
)

// NewVersion returns a cobra.Command for showing Capact CLI binary information.
func NewVersion() *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Expand Down
1 change: 1 addition & 0 deletions cmd/cloudsql-runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
)

// Config holds the input parameters for the CloudSQL runner binary.
type Config struct {
GCP cloudsql.GCPConfig
Output cloudsql.OutputConfig
Expand Down
1 change: 1 addition & 0 deletions cmd/gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type Config struct {
Auth BasicAuth
}

// BasicAuth holds the credentials for HTTP basic access authentication.
type BasicAuth struct {
Username string `envconfig:"default=graphql"`
Password string
Expand Down
Loading

0 comments on commit fb89c95

Please sign in to comment.