From 8d16fffb7c5678691c7ecf99962521b2d43788bc Mon Sep 17 00:00:00 2001
From: "Yasin, Siraj (SY495P)" <sirajudeen.yasin@gmail.com>
Date: Wed, 13 May 2020 10:41:52 -0500
Subject: [PATCH] Fix Lint warnings: Missing comments for functions

* Added comments wherever missing for exported functions/constants

Change-Id: I7d0b79b5f56fc6c3edb60a3b58c0962ebd76314c
Relates-To: #148
---
 cmd/baremetal/baremetal.go                          | 4 ++--
 pkg/config/config.go                                | 2 +-
 pkg/config/options.go                               | 5 ++---
 pkg/document/plugin/templater/v1alpha1/templater.go | 1 +
 pkg/document/repo/adapter.go                        | 4 ++++
 pkg/document/repo/repo.go                           | 4 ++++
 pkg/environment/constants.go                        | 1 +
 pkg/k8s/kubectl/interfaces.go                       | 4 ++++
 testutil/testconfig.go                              | 1 +
 9 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/cmd/baremetal/baremetal.go b/cmd/baremetal/baremetal.go
index 4929269e5..2f51b723e 100644
--- a/cmd/baremetal/baremetal.go
+++ b/cmd/baremetal/baremetal.go
@@ -72,8 +72,8 @@ func NewBaremetalCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Co
 	return baremetalRootCmd
 }
 
-// getHostSelections builds a list of selectors that can be passed to a manager using the name and label flags passed to
-// airshipctl.
+// GetHostSelections builds a list of selectors that can be passed to a manager
+// using the name and label flags passed to airshipctl.
 func GetHostSelections(name string, labels string) []remote.HostSelector {
 	var selectors []remote.HostSelector
 	if name != "" {
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 6ce0a7e6b..91d864a61 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -780,7 +780,7 @@ func (c *Config) ModifyAuthInfo(authinfo *AuthInfo, theAuthInfo *AuthInfoOptions
 	}
 }
 
-// ImportFromKubeconfig absorbs the clusters, contexts and credentials from the
+// ImportFromKubeConfig absorbs the clusters, contexts and credentials from the
 // given kubeConfig
 func (c *Config) ImportFromKubeConfig(kubeConfigPath string) error {
 	_, err := os.Stat(kubeConfigPath)
diff --git a/pkg/config/options.go b/pkg/config/options.go
index 54dc95411..63f341a10 100644
--- a/pkg/config/options.go
+++ b/pkg/config/options.go
@@ -55,9 +55,6 @@ type ClusterOptions struct {
 	EmbedCAData           bool
 }
 
-// Validate checks for the possible authentication values and returns
-// Error when invalid value or incompatible choice of values given
-
 // TODO(howell): The following functions are tightly coupled with flags passed
 // on the command line. We should find a way to remove this coupling, since it
 // is possible to create (and validate) these objects without using the command
@@ -65,6 +62,8 @@ type ClusterOptions struct {
 
 // TODO(howell): strongly type the errors in this file
 
+// Validate checks for the possible authentication values and returns
+// Error when invalid value or incompatible choice of values given
 func (o *AuthInfoOptions) Validate() error {
 	// TODO(howell): This prevents a user of airshipctl from creating a
 	// credential with both a bearer-token and a user/password, but it does
diff --git a/pkg/document/plugin/templater/v1alpha1/templater.go b/pkg/document/plugin/templater/v1alpha1/templater.go
index 3976a0ecb..e89d99be1 100644
--- a/pkg/document/plugin/templater/v1alpha1/templater.go
+++ b/pkg/document/plugin/templater/v1alpha1/templater.go
@@ -11,6 +11,7 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 */
+
 package v1alpha1
 
 import (
diff --git a/pkg/document/repo/adapter.go b/pkg/document/repo/adapter.go
index 7e26001e0..bc26097cc 100644
--- a/pkg/document/repo/adapter.go
+++ b/pkg/document/repo/adapter.go
@@ -42,6 +42,7 @@ type GitDriver struct {
 	Storer     storage.Storer
 }
 
+// NewGitDriver returns GitDriver with given storer and Filesystem
 func NewGitDriver(fs billy.Filesystem, s storage.Storer) Adapter {
 	return &GitDriver{Storer: s, Filesystem: fs}
 }
@@ -56,6 +57,7 @@ func (g *GitDriver) Open() error {
 	return nil
 }
 
+// IsOpen returns true if repository is already cloned
 func (g *GitDriver) IsOpen() bool {
 	if g.Repository == nil {
 		return false
@@ -78,10 +80,12 @@ func (g *GitDriver) Clone(co *git.CloneOptions) error {
 	return nil
 }
 
+// SetFilesystem updates given Filesystem in GitDriver.Filesystem
 func (g *GitDriver) SetFilesystem(fs billy.Filesystem) {
 	g.Filesystem = fs
 }
 
+// SetStorer updates given Storer in GitDriver.Filesystem
 func (g *GitDriver) SetStorer(s storage.Storer) {
 	g.Storer = s
 }
diff --git a/pkg/document/repo/repo.go b/pkg/document/repo/repo.go
index 2793e910b..70ed3f573 100644
--- a/pkg/document/repo/repo.go
+++ b/pkg/document/repo/repo.go
@@ -31,11 +31,15 @@ import (
 	"opendev.org/airship/airshipctl/pkg/util"
 )
 
+//TODO(sy495p): Switch to strongly-typed errors in this file
+
+// variables for repository errors
 var (
 	ErrNoOpenRepo   = errors.New("no open repository is stored")
 	ErrCantParseURL = errors.New("could not get target directory from url")
 )
 
+// OptionsBuilder interface provides specification for a repository implementation
 type OptionsBuilder interface {
 	ToAuth() (transport.AuthMethod, error)
 	ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions
diff --git a/pkg/environment/constants.go b/pkg/environment/constants.go
index 887bb80e5..fa926ee89 100644
--- a/pkg/environment/constants.go
+++ b/pkg/environment/constants.go
@@ -14,4 +14,5 @@
 
 package environment
 
+// HomeEnvVar holds value of HOME directory from env
 const HomeEnvVar = "$HOME"
diff --git a/pkg/k8s/kubectl/interfaces.go b/pkg/k8s/kubectl/interfaces.go
index e57f835c5..28649f2ac 100644
--- a/pkg/k8s/kubectl/interfaces.go
+++ b/pkg/k8s/kubectl/interfaces.go
@@ -18,6 +18,10 @@ import (
 	"opendev.org/airship/airshipctl/pkg/document"
 )
 
+//TODO(sy495p): type name "Interface" is too generic. Use a more specific name
+
+// Interface provides a abstraction layer built on top of kubectl libraries
+// to implement kubectl subcommands as kubectl apply
 type Interface interface {
 	Apply(docs []document.Document, ao *ApplyOptions) error
 	ApplyOptions() (*ApplyOptions, error)
diff --git a/testutil/testconfig.go b/testutil/testconfig.go
index 9ded62399..1efdc27ba 100644
--- a/testutil/testconfig.go
+++ b/testutil/testconfig.go
@@ -235,6 +235,7 @@ func DummyAuthInfoOptions() *config.AuthInfoOptions {
 	return authinfo
 }
 
+// DummyBootstrapInfo creates a dummy BootstrapInfo config object for unit testing
 func DummyBootstrapInfo() *config.Bootstrap {
 	bs := &config.Bootstrap{}
 	cont := config.Container{