Showing 85 of 107 total issues
Function objectSignaturesFromNotes
has 7 return statements (exceeds 4 allowed). Open
Open
func objectSignaturesFromNotes(repo *git.Repository, objectID string) ([]string, error) {
ref, err := repo.Reference(notesReferenceName, true)
if err != nil {
if err == plumbing.ErrReferenceNotFound {
return nil, nil
Avoid deeply nested control flow statements. Open
Open
if len(artifactsTarStopReadCode) > codeCursor+1 {
codeCursor++
} else {
return nil
}
Avoid deeply nested control flow statements. Open
Open
if len(artifactsTarStartReadCode) > codeCursor+1 {
codeCursor++
startReadCodeSuspectedBytes = append(startReadCodeSuspectedBytes, b)
} else {
Method Publisher.StageReleaseTarget
has 7 return statements (exceeds 4 allowed). Open
Open
func (publisher *Publisher) StageReleaseTarget(ctx context.Context, repository RepositoryInterface, releaseName, releaseFilePath string, data io.Reader) error {
publisher.mu.Lock()
defer publisher.mu.Unlock()
pathParts := SplitFilepath(filepath.Clean(releaseFilePath))
Method Manager.cleanupTaskHistory
has 7 return statements (exceeds 4 allowed). Open
Open
func (m *Manager) cleanupTaskHistory(ctx context.Context, req *logical.Request) error {
// define taskHistoryLimit
taskHistoryLimit := fieldDefaultTaskHistoryLimit
{
config, err := getConfiguration(ctx, req.Storage)
Function ReadTarFromImageBuildResponse
has 7 return statements (exceeds 4 allowed). Open
Open
func ReadTarFromImageBuildResponse(tarWriter, buildLogWriter io.Writer, response types.ImageBuildResponse) error {
dec := json.NewDecoder(response.Body)
currentState := checkingStartCode
var codeCursor int
var bufferedData []byte
Function buildReleaseArtifacts
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func buildReleaseArtifacts(ctx context.Context, tarWriter *nio.PipeWriter, gitRepo *git.Repository, fromImage string, runCommands []string, logger hclog.Logger) (error, func() error) {
Method Client.setup
has 7 return statements (exceeds 4 allowed). Open
Open
func (c *Client) setup(rootVersion int64, rootSha512 string) error {
var rootBasename string
if rootVersion == 0 {
rootBasename = "root.json"
} else {
Function addCmd
has 7 return statements (exceeds 4 allowed). Open
Open
func addCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "add REPO URL ROOT_VERSION ROOT_SHA512",
Short: "Add a software repository",
DisableFlagsInUseLine: true,
Avoid deeply nested control flow statements. Open
Open
} else if _, err := buildLogWriter.Write([]byte{b}); err != nil {
return fmt.Errorf("build log writer failed: %w", err)
}
Function verifyObjectSignatures
has 7 return statements (exceeds 4 allowed). Open
Open
func verifyObjectSignatures(repo *git.Repository, objectID string, trustedPGPPublicKeys []string, requiredNumberOfVerifiedSignatures int, logger hclog.Logger) error {
signatures, err := objectSignaturesFromNotes(repo, objectID)
if err != nil {
if strings.HasSuffix(err.Error(), plumbing.ErrObjectNotFound.Error()) {
logger.Debug(fmt.Sprintf("[DEBUG-SIGNATURES] git object not found (%s): exiting", err))
Avoid deeply nested control flow statements. Open
Open
if _, err := buildLogWriter.Write(append(startReadCodeSuspectedBytes, b)); err != nil {
return fmt.Errorf("build log writer failed: %w", err)
}
Function dirPathCmd
has 7 return statements (exceeds 4 allowed). Open
Open
func dirPathCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "dir-path REPO GROUP [CHANNEL]",
Short: "Get the directory with software artifacts",
DisableFlagsInUseLine: true,
Function execCmd
has 6 return statements (exceeds 4 allowed). Open
Open
func execCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "exec REPO GROUP [CHANNEL] [BINARY_NAME] [--] [ARGS]",
Short: "Exec a software binary",
DisableFlagsInUseLine: true,
Method Client.findChannelReleaseBinPath
has 6 return statements (exceeds 4 allowed). Open
Open
func (c Client) findChannelReleaseBinPath(group, channel, optionalBinName string) (string, error) {
dir, releaseName, err := c.findChannelReleaseBinDir(group, channel)
if err != nil {
return "", err
}
Function setDefaultChannelCmd
has 6 return statements (exceeds 4 allowed). Open
Open
func setDefaultChannelCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "set-default-channel REPO CHANNEL",
Short: "Set a default channel for a registered repository",
Long: `Set a default channel for a registered repository.
Method Publisher.GetRepository
has 6 return statements (exceeds 4 allowed). Open
Open
func (publisher *Publisher) GetRepository(ctx context.Context, storage logical.Storage, options RepositoryOptions) (RepositoryInterface, error) {
publisher.mu.Lock()
defer publisher.mu.Unlock()
awsConfig := &aws.Config{
Function switchTaskToRunningInStorage
has 6 return statements (exceeds 4 allowed). Open
Open
func switchTaskToRunningInStorage(ctx context.Context, storage logical.Storage, uuid string) error {
// get previous task state from storage
var prevTask *Task
{
t, err := getTaskFromStorage(ctx, storage, taskStateQueued, uuid)
Method Client.initTufClient
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *Client) initTufClient() error {
localDB, err := leveldbstore.FileLocalStore(c.metaLocalStoreDir)
if err != nil {
return fmt.Errorf("unable to init file local store: %w", err)
}
Method Client.CleanReleases
has 6 return statements (exceeds 4 allowed). Open
Open
func (c Client) CleanReleases() error {
actualLocalReleases, err := c.getActualLocalReleases()
if err != nil {
return fmt.Errorf("unable to get actual local releases: %w", err)
}