Skip to content
Snippets Groups Projects
Commit 2ffd42f0 authored by Fabian Seidl's avatar Fabian Seidl
Browse files

fugly godot commit

parent 02352b3b
No related branches found
No related tags found
1 merge request!363Resolve "Improve security by enabling and enforcing more linting rules"
Pipeline #110847 passed
This commit is part of merge request !363. Comments created here will be created in the context of that merge request.
Showing with 38 additions and 37 deletions
......@@ -34,7 +34,7 @@ linters:
# enable the specific needed linters
# see here for full list: https://golangci-lint.run/usage/linters/
# linters to consider: gosimple, containedctx, contextcheck, depguard, errchkjson, errname, exhaustive, exhaustruct, forbidigo,
# gochecknoinits, gocognit, goconst, gocritic, godot, gofumpt, gomnd, gosec, importas, lll, nestif, nilerr, nlreturn, noctx, nolintlint,
# gochecknoinits, gocognit, goconst, gocritic, gofumpt, gomnd, gosec, importas, lll, nestif, nilerr, nlreturn, noctx, nolintlint,
# nosnakecase, paralleltest, prealloc, structcheck, testpackage, tparallel, unparam, wastedassign, wrapcheck, wsl
disable-all: true
enable:
......@@ -60,6 +60,7 @@ linters:
- misspell
- nilnil
- predeclared
- godot
# custom settings for linters
linters-settings:
......
......@@ -16,7 +16,7 @@ import (
)
// PndAdapter is an API adapter to reflect the NetworkDomain
// interface
// interface.
type PndAdapter struct {
id uuid.UUID
endpoint string
......@@ -35,12 +35,12 @@ func NewPndAdapter(id, endpoint string) (*PndAdapter, error) {
}, nil
}
// AddSbi adds an SBI to the PND Adapter. Currently not implemented
// AddSbi adds an SBI to the PND Adapter. Currently not implemented.
func (p *PndAdapter) AddSbi(s southbound.SouthboundInterface) error {
return &errors.ErrNotYetImplemented{}
}
// RemoveSbi removes an SBI from the PND Adapter. Currently not implemented
// RemoveSbi removes an SBI from the PND Adapter. Currently not implemented.
func (p *PndAdapter) RemoveSbi(uuid.UUID) error {
return &errors.ErrNotYetImplemented{}
}
......@@ -85,7 +85,7 @@ func (p *PndAdapter) GetFlattenedDevices(ctx context.Context) (*ppb.GetFlattened
return resp, nil
}
// RemoveDevice removes a device from the controller
// RemoveDevice removes a device from the controller.
func (p *PndAdapter) RemoveDevice(ctx context.Context, did uuid.UUID) (*ppb.DeleteOndResponse, error) {
resp, err := api.DeleteDevice(ctx, p.endpoint, p.id.String(), did.String())
if err != nil {
......@@ -94,7 +94,7 @@ func (p *PndAdapter) RemoveDevice(ctx context.Context, did uuid.UUID) (*ppb.Dele
return resp, nil
}
// RemovePnd removes a PND from the controller
// RemovePnd removes a PND from the controller.
func (p *PndAdapter) RemovePnd(ctx context.Context, pid uuid.UUID) (*core.DeletePndResponse, error) {
resp, err := api.DeletePnd(ctx, p.endpoint, pid.String())
if err != nil {
......@@ -105,7 +105,7 @@ func (p *PndAdapter) RemovePnd(ctx context.Context, pid uuid.UUID) (*core.Delete
// ChangeOND sends an API call to the controller requesting the creation of
// a change from the provided Operation, path and value. The Change is marked
// as Pending and times out after the specified timeout period
// as Pending and times out after the specified timeout period.
func (p *PndAdapter) ChangeOND(ctx context.Context, duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (*ppb.SetPathListResponse, error) {
var v string
if len(value) != 0 {
......@@ -119,7 +119,7 @@ func (p *PndAdapter) ChangeOND(ctx context.Context, duid uuid.UUID, operation pp
}
// Request sends an API call to the controller requesting the specified path
// for the specified device
// for the specified device.
func (p *PndAdapter) Request(ctx context.Context, did uuid.UUID, path string) (*ppb.GetPathResponse, error) {
resp, err := api.GetPath(ctx, p.endpoint, p.id.String(), did.String(), path)
if err != nil {
......@@ -129,7 +129,7 @@ func (p *PndAdapter) Request(ctx context.Context, did uuid.UUID, path string) (*
}
// SubscribeONDPath sends an API call to the controller requesting to subscribe
// to a specific path of a specifc device
// to a specific path of a specifc device.
func (p *PndAdapter) SubscribeONDPath(ctx context.Context, did uuid.UUID, slist *ppb.SubscriptionList) (ppb.PndService_SubscribePathClient, error) {
resp, err := api.SubscribePath(ctx, p.endpoint, p.id.String(), did.String(), slist)
if err != nil {
......@@ -169,7 +169,7 @@ func (p *PndAdapter) RequestAll(ctx context.Context, path string) ([]proto.Messa
}
// ContainsDevice sends an API call to the controller checking if a device
// with the given UUID is present. Not implemented, always returns false
// with the given UUID is present. Not implemented, always returns false.
func (p *PndAdapter) ContainsDevice(uuid.UUID) bool {
return false
}
......@@ -185,7 +185,7 @@ func (p *PndAdapter) GetSbi(ctx context.Context, sid string) (*ppb.GetSbiRespons
}
// GetSBIs sends an API call to the controller requesting the
// registered SBIs. Not implemented, always returns nil
// registered SBIs. Not implemented, always returns nil.
func (p *PndAdapter) GetSBIs(ctx context.Context) (*ppb.GetSbiListResponse, error) {
resp, err := api.GetSBIs(ctx, p.endpoint, p.id.String())
if err != nil {
......@@ -194,18 +194,18 @@ func (p *PndAdapter) GetSBIs(ctx context.Context) (*ppb.GetSbiListResponse, erro
return resp, nil
}
// ID returns the PND Adapter's UUID
// ID returns the PND Adapter's UUID.
func (p *PndAdapter) ID() uuid.UUID {
return p.id
}
// Endpoint returns the PND Adapter's endpoint
// Endpoint returns the PND Adapter's endpoint.
func (p *PndAdapter) Endpoint() string {
return p.endpoint
}
// PendingChanges sends an API call to the controller requesting
// the UUIDs of all pending changes
// the UUIDs of all pending changes.
func (p *PndAdapter) PendingChanges(ctx context.Context) ([]*ppb.Change, error) {
resp, err := api.GetChanges(ctx, p.endpoint, p.id.String())
if err != nil {
......@@ -215,7 +215,7 @@ func (p *PndAdapter) PendingChanges(ctx context.Context) ([]*ppb.Change, error)
}
// CommittedChanges sends an API call to the controller requesting
// the UUIDs of all committed changes
// the UUIDs of all committed changes.
func (p *PndAdapter) CommittedChanges(ctx context.Context) ([]*ppb.Change, error) {
resp, err := api.GetChanges(ctx, p.endpoint, p.id.String())
if err != nil {
......@@ -225,7 +225,7 @@ func (p *PndAdapter) CommittedChanges(ctx context.Context) ([]*ppb.Change, error
}
// ConfirmedChanges sends an API call to the controller requesting
// the UUIDs of all confirmed changes
// the UUIDs of all confirmed changes.
func (p *PndAdapter) ConfirmedChanges(ctx context.Context) ([]*ppb.Change, error) {
resp, err := api.GetChanges(ctx, p.endpoint, p.id.String())
if err != nil {
......@@ -235,7 +235,7 @@ func (p *PndAdapter) ConfirmedChanges(ctx context.Context) ([]*ppb.Change, error
}
// GetChange sends an API call to the controller requesting one or more changes
// for the specific PND
// for the specific PND.
func (p *PndAdapter) GetChange(ctx context.Context, identifier ...string) (*ppb.GetChangeResponse, error) {
resp, err := api.GetChange(ctx, p.endpoint, p.id.String(), identifier...)
if err != nil {
......@@ -244,7 +244,7 @@ func (p *PndAdapter) GetChange(ctx context.Context, identifier ...string) (*ppb.
return resp, nil
}
// Commit sends an API call to the controller committing the specified change
// Commit sends an API call to the controller committing the specified change.
func (p *PndAdapter) Commit(ctx context.Context, cuid uuid.UUID) (*ppb.SetChangeListResponse, error) {
resp, err := api.Commit(ctx, p.endpoint, p.id.String(), cuid.String())
if err != nil {
......@@ -253,7 +253,7 @@ func (p *PndAdapter) Commit(ctx context.Context, cuid uuid.UUID) (*ppb.SetChange
return resp, nil
}
// Confirm sends an API call to the controller confirming the specified change
// Confirm sends an API call to the controller confirming the specified change.
func (p *PndAdapter) Confirm(ctx context.Context, cuid uuid.UUID) (*ppb.SetChangeListResponse, error) {
resp, err := api.Confirm(ctx, p.endpoint, p.id.String(), cuid.String())
if err != nil {
......
......@@ -35,7 +35,7 @@ import (
"github.com/spf13/cobra"
)
// changeCmd represents the change command
// changeCmd represents the change command.
var changeCmd = &cobra.Command{
Use: "change",
Short: "manage changes of the specified PND",
......
......@@ -37,7 +37,7 @@ import (
"github.com/spf13/cobra"
)
// commitCmd represents the commit command
// commitCmd represents the commit command.
var commitCmd = &cobra.Command{
Use: "commit [uuid]",
Args: cobra.ExactArgs(1),
......
......@@ -37,7 +37,7 @@ import (
"github.com/spf13/cobra"
)
// confirmCmd represents the confirm command
// confirmCmd represents the confirm command.
var confirmCmd = &cobra.Command{
Use: "confirm [uuid]",
Args: cobra.ExactArgs(1),
......
......@@ -37,7 +37,7 @@ import (
"google.golang.org/protobuf/encoding/protojson"
)
// confirmCmd represents the confirm command
// confirmCmd represents the confirm command.
var getCmd = &cobra.Command{
Use: "get [uuid]",
Args: cobra.ExactArgs(1),
......
......@@ -36,7 +36,7 @@ import (
"github.com/spf13/cobra"
)
// changeListCmd represents the list command
// changeListCmd represents the list command.
var changeListCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
......
......@@ -41,7 +41,7 @@ var password string
//var duid string
// deviceCmd represents the device command
// deviceCmd represents the device command.
var deviceCmd = &cobra.Command{
Use: "device",
Aliases: []string{"dev"},
......
......@@ -40,7 +40,7 @@ import (
tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
)
// deviceCreateCmd represents the create command
// deviceCreateCmd represents the create command.
var deviceCreateCmd = &cobra.Command{
Use: "create",
Short: "creates a device on the controller",
......
......@@ -38,7 +38,7 @@ import (
"github.com/spf13/cobra"
)
// deviceDeleteCmd represents the delete command
// deviceDeleteCmd represents the delete command.
var deviceDeleteCmd = &cobra.Command{
Use: "delete [uuid] [path]",
Args: cobra.ExactArgs(2),
......
......@@ -39,7 +39,7 @@ import (
"google.golang.org/protobuf/encoding/protojson"
)
// deviceGetCmd represents the get command
// deviceGetCmd represents the get command.
var deviceGetCmd = &cobra.Command{
Use: "get [uuid] [path]",
Args: cobra.ExactArgs(2),
......
......@@ -37,7 +37,7 @@ import (
"github.com/spf13/cobra"
)
// deviceListCmd represents the listDevice command
// deviceListCmd represents the listDevice command.
var deviceListCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
......
......@@ -38,7 +38,7 @@ import (
"github.com/spf13/cobra"
)
// deviceRemoveCmd represents the remove command
// deviceRemoveCmd represents the remove command.
var deviceRemoveCmd = &cobra.Command{
Use: "remove [uuid]",
Aliases: []string{"rm"},
......
......@@ -44,7 +44,7 @@ var replace bool
var file string
var forcePush bool
// deviceSetCmd represents the set command
// deviceSetCmd represents the set command.
var deviceSetCmd = &cobra.Command{
Use: "set [uuid] [path] [value]",
Args: cobra.RangeArgs(2, 3),
......
......@@ -36,7 +36,7 @@ import (
"github.com/spf13/cobra"
)
// deviceShowCmd represents the show command
// deviceShowCmd represents the show command.
var deviceShowCmd = &cobra.Command{
Use: "show",
Args: cobra.ExactArgs(1),
......
......@@ -42,7 +42,7 @@ import (
"github.com/spf13/cobra"
)
// deviceGetCmd represents the get command
// deviceGetCmd represents the get command.
var deviceSubscribeCmd = &cobra.Command{
Use: "subscribe [uuid] [path]",
Args: cobra.ExactArgs(2),
......
......@@ -40,7 +40,7 @@ import (
//TODO: this requires us to make getDevices in grpc.go of gosdn public and we
//also need to implement GetSBI()
// pndCmd represents the pnd command
// pndCmd represents the pnd command.
var listCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
......
......@@ -40,7 +40,7 @@ import (
"github.com/spf13/viper"
)
// loginCmd represents the login command
// loginCmd represents the login command.
var loginCmd = &cobra.Command{
Use: "login",
Short: "Logs in for further actions",
......
......@@ -40,7 +40,7 @@ import (
"github.com/spf13/viper"
)
// logoutCmd represents the logout command
// logoutCmd represents the logout command.
var logoutCmd = &cobra.Command{
Use: "logout",
Short: "Logs the current user out",
......
......@@ -35,7 +35,7 @@ import (
"github.com/spf13/cobra"
)
// pndCmd represents the pnd command
// pndCmd represents the pnd command.
var pndCmd = &cobra.Command{
Use: "pnd",
Short: "The pnd command contains all sub-commands for PND management",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment