Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix some readability nits #105

Merged
merged 4 commits into from
Oct 1, 2024
Merged

Conversation

quite
Copy link
Contributor

@quite quite commented Sep 30, 2024

No description provided.

components.go Outdated Show resolved Hide resolved
components.go Outdated
@@ -808,14 +801,14 @@ type VAlarm struct {
ComponentBase
}

func (c *VAlarm) Serialize() string {
func (alarm *VAlarm) Serialize() string {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases your corrections have used an acronym (more than 2 words I gather) and in others the words. -- Intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reworked it a bit. Using very short receiver names now, as is common practice. c for component, p for property. Then cb and bp up in their bases. And some other things.

Copy link
Owner

@arran4 arran4 Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all good. I think we can start to develop a style guide from your work here. I like what you're doing though. It's good work! Thanks

However cal instead of c or calendar strikes me as nicer for the single word types.

arran4
arran4 previously approved these changes Sep 30, 2024
@arran4
Copy link
Owner

arran4 commented Sep 30, 2024

I have no legitimate reason to reject this but can I argue for keeping the type switches?

func (attendee *Attendee) Email() string {
if strings.HasPrefix(attendee.Value, "mailto:") {
return attendee.Value[len("mailto:"):]
func (p *Attendee) Email() string {
Copy link
Owner

@arran4 arran4 Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't pushing back on this. I was ensuring consistency / intent.

func (calendar *Calendar) RemoveEvent(id string) {
for i := range calendar.Components {
switch event := calendar.Components[i].(type) {
func (cal *Calendar) RemoveEvent(id string) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I do like cal instead of c or calendar

Copy link
Owner

@arran4 arran4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I wasn't pushing back on the receiver rename just verifying / opening a discussion. However seen that calendar was cal not c makes me prefer that for single word types. Sorry, once again I will wait for your communication. If you want to talk to me about this I have opened up a discord just message me.

Sorry if it felt like I was pushing back.

@quite
Copy link
Contributor Author

quite commented Oct 1, 2024

No worries. I think it all turned out for the better now. Receiver names short, consistent to the point, and hopefully not causing confusion.

@arran4 arran4 merged commit 937429d into arran4:master Oct 1, 2024
12 checks passed
case *VAlarm:
r = append(r, alarm)
}
}
return r
}

func (alarm *VAlarm) SetAction(a Action, params ...PropertyParameter) {
alarm.SetProperty(ComponentPropertyAction, string(a), params...)
func (c *VAlarm) SetAction(a Action, params ...PropertyParameter) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess at some point I should refactor this to va

@quite quite deleted the readability-nits branch October 1, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants