-
Notifications
You must be signed in to change notification settings - Fork 33
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
New rules: Missing brackets - Triggers on Temporary records - Non-Public Event Publishers #830
New rules: Missing brackets - Triggers on Temporary records - Non-Public Event Publishers #830
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking the time and effort to bring these rules to LinterCop, they look great!
I’ve added a few minor remarks, with the most important being to lower the default severity from Warning
to Info
. As a general rule of thumb, I usually reserve warning for scenarios that could lead to (run)time errors.
If you have any concerns or feel differently about the remarks I’ve added, please don’t hesitate to share your thoughts on them.
And again thank you for these contributions 🤗
BusinessCentral.LinterCop/Design/Rule0079NonPublicEventPublisher.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Arthur van de Vondervoort <44637996+Arthurvdv@users.noreply.github.com>
Co-authored-by: Arthur van de Vondervoort <44637996+Arthurvdv@users.noreply.github.com>
This PR introduces three new rules that were part of the discussion here:
#776
Missing brackets
If a procedure is missing brackets, there's a standard rule that throws a warning, however, some internal methods are not covered by that rule. This rule introduces a warning for a few more of the most common cases (Today, WorkDate, GuiAllowed, IsEmpty, Count)
This list could be extended further; I could use some input on that front.
Triggers on Temporary Records
When triggers are executed on a temporary record variable, the temporary scope no longer applies to any code in those triggers and can lead to unwanted database changes. This rule introduces a warning that triggers (Insert, Modify, Delete, DeleteAll, ModifyAll) and Validate should not be executed on temporary record variables.
The rule does not throw a warning if the table itself is of type temporary, as it's expected that its triggers are created safely.
Non-Public Event Publisher
When an event publisher is declared as public, you cannot add parameters to it, as AppSourceCop treats it as a breaking change to a public API. Local and Internal publishers on the other hand do not have this issue. In order to keep the option of extending the publishers later, the events should be declared as either local or internal