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
}
// 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 != "" {

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

View File

@ -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

View File

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

View File

@ -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
}

View File

@ -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

View File

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

View File

@ -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)

View File

@ -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{