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 the contract analyzer #239

Merged
merged 6 commits into from
Jul 19, 2024

Conversation

yuxincs
Copy link
Contributor

@yuxincs yuxincs commented May 4, 2024

This PR simply refactors the contract analyzer to prepare for further updates. Specifically, it

(1) Defines a separate type for []Contract such that it can be made to be exported (i.e., satisfies the analysis.Fact interface) in the future.
(2) Replaces a few places where we were returning initialized empty slices with simple nil. In principle we should not distinguish nil slice vs empty nonnil slice.
(3) Shortens a few variable names to help improve readability without introducing ambiguity (since the variables are all under the functioncontracts package already).
(4) Moved test cases from src/go.uber.org/functioncontracts/xxx to src/go.uber.org/xxx inside functioncontracts package. Those tests are only meant to be used for functioncontracts package, such that an extra folder only increases nesting but does not help test organization.

Note that this PR does not bring any functionality changes.

Copy link

codecov bot commented May 4, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.55%. Comparing base (e902884) to head (edbcc2c).

Files Patch % Lines
assertion/function/functioncontracts/analyzer.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
- Coverage   87.55%   87.55%   -0.01%     
==========================================
  Files          63       63              
  Lines        7828     7825       -3     
==========================================
- Hits         6854     6851       -3     
  Misses        796      796              
  Partials      178      178              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented May 4, 2024

Golden Test

Note

✅ NilAway errors reported on standard libraries are identical.

3297 errors on base branch (main, e902884)
3297 errors on test branch (c067908)

@yuxincs yuxincs force-pushed the yuxincs/refactor-function-contract-analyzer branch from ebec5a0 to 045d6f0 Compare May 13, 2024 23:46
@yuxincs yuxincs force-pushed the yuxincs/refactor-function-contract-analyzer branch from 045d6f0 to 4c694b0 Compare May 14, 2024 19:15
Copy link
Contributor

@sonalmahajan15 sonalmahajan15 left a comment

Choose a reason for hiding this comment

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

Looks good. The refactors in this PR make sense to me.

@yuxincs yuxincs merged commit 613d002 into main Jul 19, 2024
8 checks passed
@yuxincs yuxincs deleted the yuxincs/refactor-function-contract-analyzer branch July 19, 2024 15:13
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