Showing 247 of 615 total issues
Method Preparer.getValueForField
has 8 return statements (exceeds 4 allowed). Open
Open
func (p *Preparer) getValueForField(r Renderer, field reflect.StructField) (reflect.Value, error) {
// get the field name for use in future lookups
name := p.getFieldName(field)
raw, isSet := p.Source[name]
Method Unarchive.setDirsAndContents
has 8 return statements (exceeds 4 allowed). Open
Open
func (u *Unarchive) setDirsAndContents() (bool, error) {
var err error
// set the unarchive destination directory
u.destDir, err = os.Open(u.Destination)
Function checkSyntax
has 8 return statements (exceeds 4 allowed). Open
Open
func checkSyntax(interpreter string, flags []string, script string) error {
if interpreter == "" {
interpreter = defaultInterpreter
if len(flags) > 0 {
return errors.New("custom syntax check_flags given without an interpreter")
Method Resource.shouldStop
has 8 return statements (exceeds 4 allowed). Open
Open
func (r *Resource) shouldStop(u *Unit, st *resource.Status) bool {
switch u.ActiveState {
case "active":
st.AddDifference("state", "active", "inactive", "")
st.RaiseLevel(resource.StatusWillChange)
Function PeerBranches
has 8 return statements (exceeds 4 allowed). Open
Open
func PeerBranches(g *graph.Graph, meta *node.Node) (out []*node.Node) {
if !IsConditional(meta) {
return
}
kind, ok := meta.LookupMetadata(MetaType)
Method TypeExtractor.Visit
has 8 return statements (exceeds 4 allowed). Open
Open
func (te *TypeExtractor) Visit(node ast.Node) (w ast.Visitor) {
if node == nil {
return nil
}
Method Resource.shouldStart
has 8 return statements (exceeds 4 allowed). Open
Open
func (r *Resource) shouldStart(u *Unit, st *resource.Status) bool {
switch u.ActiveState {
case "active":
st.AddMessage("already running")
return false
Function Nodes
has 8 return statements (exceeds 4 allowed). Open
Open
func Nodes(ctx context.Context, root string, verify bool) (*graph.Graph, error) {
logger := logging.GetLogger(ctx).WithField("function", "Nodes")
toLoad := []*source{{"root", root, root}}
Function getParamOverrides
has 7 return statements (exceeds 4 allowed). Open
Open
func getParamOverrides(gFunc func() *graph.Graph, id string) (ValueThunk, bool) {
name := graph.BaseID(id)
f := func() (resource.Value, bool, error) { return resource.Value(""), false, nil }
if strings.HasPrefix(name, "param") {
f = func() (resource.Value, bool, error) {
Method pipelineGen.MaybeResolveConditional
has 7 return statements (exceeds 4 allowed). Open
Open
func (g *pipelineGen) MaybeResolveConditional(_ context.Context, idi interface{}) (interface{}, error) {
meta, ok := g.Graph.Get(g.ID)
if !ok {
return nil, errors.New("unexpectedly unable to find " + g.ID + " in graph")
}
Avoid deeply nested control flow statements. Open
Open
if err != nil {
status.RaiseLevel(resource.StatusFatal)
status.Output = append(status.Output, fmt.Sprintf("error adding group %s", g.Name))
return status, errors.Wrap(err, "group add")
}
Avoid deeply nested control flow statements. Open
Open
if err != nil {
status.RaiseLevel(resource.StatusFatal)
status.Output = append(status.Output, fmt.Sprintf("error modifying group %s with new name %s and new gid %s", g.Name, g.NewName, g.GID))
return status, errors.Wrap(err, "group modify")
}
Function TestRetryUntil
has 7 return statements (exceeds 4 allowed). Open
Open
func TestRetryUntil(t *testing.T) {
t.Parallel()
defer logging.HideLogs(t)()
t.Run("sets retry count", func(t *testing.T) {
Method Unarchive.evaluateDuplicates
has 7 return statements (exceeds 4 allowed). Open
Open
func (u *Unarchive) evaluateDuplicates() error {
// determine which directory has fewer items in order to minimize operations
dirA := u.destDir.Name()
dirB := u.fetchDir.Name()
filesA := u.destContents
Avoid deeply nested control flow statements. Open
Open
if err != nil {
status.RaiseLevel(resource.StatusFatal)
status.Output = append(status.Output, fmt.Sprintf("error modifying group %s", g.Name))
return status, errors.Wrap(err, "group modify")
}
Avoid deeply nested control flow statements. Open
Open
if err != nil {
status.RaiseLevel(resource.StatusFatal)
status.Output = append(status.Output, fmt.Sprintf("error adding group %s with gid %s", g.Name, g.GID))
return status, errors.Wrap(err, "group add")
}
Method User.DiffMod
has 7 return statements (exceeds 4 allowed). Open
Open
func (u *User) DiffMod(status *resource.Status, currUser *user.User) (*ModUserOptions, error) {
options := new(ModUserOptions)
// Check for differences between currUser and the desired modifications
if u.NewUsername != "" {
Avoid deeply nested control flow statements. Open
Open
if err != nil {
status.RaiseLevel(resource.StatusFatal)
status.Output = append(status.Output, fmt.Sprintf("error modifying group %s with new gid %s", g.Name, g.GID))
return status, errors.Wrap(err, "group modify")
}
Function simpleCheckSuccess
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func simpleCheckSuccess(t *testing.T, lvm lowlevel.LVM, group string, devs []string, remove bool, forceRemove bool) (resource.TaskStatus, resource.Task) {
Function simpleCheckFailure
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func simpleCheckFailure(t *testing.T, lvm lowlevel.LVM, group string, devs []string, remove bool, forceRemove bool) resource.TaskStatus {