Skip to content

Package Contracts5#113

Merged
knewbury01 merged 14 commits intogithub:mainfrom
mbaluda-org:Contracts5
Jan 16, 2023
Merged

Package Contracts5#113
knewbury01 merged 14 commits intogithub:mainfrom
mbaluda-org:Contracts5

Conversation

@mbaluda
Copy link
Copy Markdown
Collaborator

@mbaluda mbaluda commented Nov 1, 2022

Description

  • ERR32-C
  • ERR33-C

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • ERR32-C
    • ERR33-C
  • Queries have been modified for the following rules:
    • ERR30-C

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

@mbaluda mbaluda self-assigned this Nov 1, 2022
@mbaluda mbaluda requested a review from knewbury01 November 1, 2022 01:32
Copy link
Copy Markdown
Collaborator

@knewbury01 knewbury01 left a comment

Choose a reason for hiding this comment

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

Hey @mbaluda ! I've made some initial comments, will need to come back for a more deep look at implementation after you've had some thoughts on these comments :)

you always have the most "case heavy" rules it seems!

Comment thread c/cert/src/rules/ERR33-C/DetectAndHandleStandardLibraryErrors.ql Outdated
Comment thread c/cert/src/rules/ERR33-C/DetectAndHandleStandardLibraryErrors.ql Outdated
Comment thread rule_packages/c/Contracts5.json
Comment thread rule_packages/c/Contracts5.json Outdated
Comment thread c/cert/src/rules/ERR33-C/DetectAndHandleStandardLibraryErrors.ql Outdated
Comment thread c/cert/test/rules/ERR33-C/test.c
@mbaluda mbaluda requested a review from knewbury01 November 3, 2022 18:58
@mbaluda
Copy link
Copy Markdown
Collaborator Author

mbaluda commented Nov 3, 2022

@knewbury01 I added the implementation for rule ERR32-C

Copy link
Copy Markdown
Collaborator

@knewbury01 knewbury01 left a comment

Choose a reason for hiding this comment

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

ERR32-C reviewed! I was trying to be quite picky on edge cases but I am not totally sure if my testcase suggestions are realistic. otherwise looking good, these rules are very cool !

will submit a separate (re)review for ERR33-C

Comment thread c/cert/test/rules/ERR33-C/test.c
Comment thread c/cert/src/rules/ERR32-C/DoNotRelyOnIndeterminateValuesOfErrno.ql Outdated
Comment thread c/cert/test/rules/ERR32-C/test.c
Comment thread c/cert/test/rules/ERR32-C/test.c
Comment thread c/cert/test/rules/ERR32-C/test.c
Comment thread c/cert/src/rules/ERR33-C/DetectAndHandleStandardLibraryErrors.ql
@mbaluda mbaluda requested a review from knewbury01 December 7, 2022 10:39
@mbaluda
Copy link
Copy Markdown
Collaborator Author

mbaluda commented Dec 7, 2022

Rule ERR33-C was modified to improve the performance and to avoid false negatives arising when an expected error check expression is not present in the DB (see the added test)

Copy link
Copy Markdown
Collaborator

@knewbury01 knewbury01 left a comment

Choose a reason for hiding this comment

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

@mbaluda both queries reviewed,
ERR33-C looks good to me !
2 minor questions on ERR32-C, but after those tiny things I think it will be good to go

Comment thread c/cert/test/rules/ERR32-C/test.c
Comment thread c/cert/src/rules/ERR32-C/DoNotRelyOnIndeterminateValuesOfErrno.ql Outdated
@knewbury01 knewbury01 self-requested a review January 16, 2023 19:13
Copy link
Copy Markdown
Collaborator

@knewbury01 knewbury01 left a comment

Choose a reason for hiding this comment

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

I believe we have combed this PR over very thoroughly!

the only remaining note is this one but I do not see it as a requirement for this rule, and can be addressed as an enhancement if required.

good work @mbaluda :)

@knewbury01 knewbury01 enabled auto-merge January 16, 2023 19:16
@knewbury01 knewbury01 merged commit 7072866 into github:main Jan 16, 2023
@mbaluda mbaluda deleted the Contracts5 branch January 25, 2023 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants