Skip to content

Allow cuddle assignments if used first in sub-blocks #50

@dionysius

Description

@dionysius

Just a suggestion, I can also see it as intentional, since it would allow too complicated blocks maybe. I stumble a lot into that in my code, so I have some examples and can tackle down if and how we can improve this. I'm also very critic to myself that this suggestion is wrong and I have to overthink my code :)

what this rule wants:

	r := map[string]string{}
	for k, v := range m {
		r[k] = v
	}

I often have a range with a little if if !thisorthat()

	r := map[string]string{}
	for k, v := range m {
		if !c.IsReserved(k) {
			r[k] = v
		}
	}

Or a switch-case:

	c.Environment = make(map[string]string)
	for _, env := range req.GetConfig().GetEnvs() {
		switch env.GetKey() {
		case "user-data":
			c.CloudInitUserData = env.GetValue()
		default:
			c.Environment[env.GetKey()] = env.GetValue()
		}
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions