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

Precise event naming convention #14

Merged
merged 4 commits into from
Apr 24, 2024
Merged

Precise event naming convention #14

merged 4 commits into from
Apr 24, 2024

Conversation

xenoliss
Copy link
Contributor

In addition to recommending the usage of past tense for events naming, this PR further advise to follow a WhatAction(e.g. OwnerUpdated) format rather than ActionWhat (e.g. UpdatedOwner).

README.md Outdated

Events should track things that _happened_ and so should be past tense. Using past tense also helps avoid naming collisions with structs or functions.
Events should track things that _happened_ and so should be past tense. Using past tense also helps avoid naming collisions with structs or functions. We also recommend following the `WhatAction`(e.g. `OwnerUpdated`) format rather than `ActionWhat` (e.g. `UpdatedOwner`).
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe more clear to use parts of speech naming?

Suggested change
Events should track things that _happened_ and so should be past tense. Using past tense also helps avoid naming collisions with structs or functions. We also recommend following the `WhatAction`(e.g. `OwnerUpdated`) format rather than `ActionWhat` (e.g. `UpdatedOwner`).
Events should track things that _happened_ and so should be past tense. Using past tense also helps avoid naming collisions with structs or functions. We also recommend following the `SubjectVerb`(e.g. `OwnerUpdated`) format rather than `VerbSubject` (e.g. `UpdatedOwner`).

@ilikesymmetry
Copy link

+1 to this!

README.md Outdated

Events should track things that _happened_ and so should be past tense. Using past tense also helps avoid naming collisions with structs or functions.
Events should track things that _happened_ and so should be past tense. Using past tense also helps avoid naming collisions with structs or functions. We also recommend following the `SubjectVerb`(e.g. `OwnerUpdated`) format rather than `VerbSubject` (e.g. `UpdatedOwner`).
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry @xenoliss one more comment here. I think We also recommend... could be its own rule? Not sure we need to bundle with past tense

README.md Outdated
event OwnerUpdated(address newOwner);
```

##### B. Prefer `SubjectVerb` naming format
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
##### B. Prefer `SubjectVerb` naming format
##### B. Prefer `SubjectVerb` naming format.

@xenoliss xenoliss merged commit 4c35c62 into main Apr 24, 2024
3 checks passed
@xenoliss xenoliss deleted the baptiste/events branch April 24, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants