Fix Lint warnings: Missing comments for functions

* Added comments wherever missing for exported functions/constants

Change-Id: I7d0b79b5f56fc6c3edb60a3b58c0962ebd76314c
Relates-To: #148
This commit is contained in:
Yasin, Siraj (SY495P) 2020-05-13 10:41:52 -05:00 committed by Alexander Hughes
parent 98f14aaa93
commit 8d16fffb7c
9 changed files with 20 additions and 6 deletions

View File

@ -72,8 +72,8 @@ func NewBaremetalCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Co
return baremetalRootCmd return baremetalRootCmd
} }
// getHostSelections builds a list of selectors that can be passed to a manager using the name and label flags passed to // GetHostSelections builds a list of selectors that can be passed to a manager
// airshipctl. // using the name and label flags passed to airshipctl.
func GetHostSelections(name string, labels string) []remote.HostSelector { func GetHostSelections(name string, labels string) []remote.HostSelector {
var selectors []remote.HostSelector var selectors []remote.HostSelector
if name != "" { if name != "" {

View File

@ -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 // given kubeConfig
func (c *Config) ImportFromKubeConfig(kubeConfigPath string) error { func (c *Config) ImportFromKubeConfig(kubeConfigPath string) error {
_, err := os.Stat(kubeConfigPath) _, err := os.Stat(kubeConfigPath)

View File

@ -55,9 +55,6 @@ type ClusterOptions struct {
EmbedCAData bool 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 // 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 // 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 // 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 // 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 { func (o *AuthInfoOptions) Validate() error {
// TODO(howell): This prevents a user of airshipctl from creating a // TODO(howell): This prevents a user of airshipctl from creating a
// credential with both a bearer-token and a user/password, but it does // credential with both a bearer-token and a user/password, but it does

View File

@ -11,6 +11,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package v1alpha1 package v1alpha1
import ( import (

View File

@ -42,6 +42,7 @@ type GitDriver struct {
Storer storage.Storer Storer storage.Storer
} }
// NewGitDriver returns GitDriver with given storer and Filesystem
func NewGitDriver(fs billy.Filesystem, s storage.Storer) Adapter { func NewGitDriver(fs billy.Filesystem, s storage.Storer) Adapter {
return &GitDriver{Storer: s, Filesystem: fs} return &GitDriver{Storer: s, Filesystem: fs}
} }
@ -56,6 +57,7 @@ func (g *GitDriver) Open() error {
return nil return nil
} }
// IsOpen returns true if repository is already cloned
func (g *GitDriver) IsOpen() bool { func (g *GitDriver) IsOpen() bool {
if g.Repository == nil { if g.Repository == nil {
return false return false
@ -78,10 +80,12 @@ func (g *GitDriver) Clone(co *git.CloneOptions) error {
return nil return nil
} }
// SetFilesystem updates given Filesystem in GitDriver.Filesystem
func (g *GitDriver) SetFilesystem(fs billy.Filesystem) { func (g *GitDriver) SetFilesystem(fs billy.Filesystem) {
g.Filesystem = fs g.Filesystem = fs
} }
// SetStorer updates given Storer in GitDriver.Filesystem
func (g *GitDriver) SetStorer(s storage.Storer) { func (g *GitDriver) SetStorer(s storage.Storer) {
g.Storer = s g.Storer = s
} }

View File

@ -31,11 +31,15 @@ import (
"opendev.org/airship/airshipctl/pkg/util" "opendev.org/airship/airshipctl/pkg/util"
) )
//TODO(sy495p): Switch to strongly-typed errors in this file
// variables for repository errors
var ( var (
ErrNoOpenRepo = errors.New("no open repository is stored") ErrNoOpenRepo = errors.New("no open repository is stored")
ErrCantParseURL = errors.New("could not get target directory from url") ErrCantParseURL = errors.New("could not get target directory from url")
) )
// OptionsBuilder interface provides specification for a repository implementation
type OptionsBuilder interface { type OptionsBuilder interface {
ToAuth() (transport.AuthMethod, error) ToAuth() (transport.AuthMethod, error)
ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions

View File

@ -14,4 +14,5 @@
package environment package environment
// HomeEnvVar holds value of HOME directory from env
const HomeEnvVar = "$HOME" const HomeEnvVar = "$HOME"

View File

@ -18,6 +18,10 @@ import (
"opendev.org/airship/airshipctl/pkg/document" "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 { type Interface interface {
Apply(docs []document.Document, ao *ApplyOptions) error Apply(docs []document.Document, ao *ApplyOptions) error
ApplyOptions() (*ApplyOptions, error) ApplyOptions() (*ApplyOptions, error)

View File

@ -235,6 +235,7 @@ func DummyAuthInfoOptions() *config.AuthInfoOptions {
return authinfo return authinfo
} }
// DummyBootstrapInfo creates a dummy BootstrapInfo config object for unit testing
func DummyBootstrapInfo() *config.Bootstrap { func DummyBootstrapInfo() *config.Bootstrap {
bs := &config.Bootstrap{} bs := &config.Bootstrap{}
cont := config.Container{ cont := config.Container{