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: Rename ambiguous network variables #7089

Merged
merged 3 commits into from
Aug 31, 2023

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Aug 30, 2023

Development & PR Process

  1. Follow MetaMask Mobile Coding Standards
  2. Add release-xx label to identify the PR slated for a upcoming release (will be used in release discussion)
  3. Add needs-dev-review label when work is completed
  4. Add the appropiate QA label when dev review is completed
    • needs-qa: PR requires manual QA.
    • No QA/E2E only: PR does not require any manual QA effort. Prior to merging, ensure that you have successful end-to-end test runs in Bitrise.
    • Spot check on release build: PR does not require feature QA but needs non-automated verification. In the description section, provide test scenarios. Add screenshots, and or recordings of what was tested.
  5. Add QA Passed label when QA has signed off (Only required if the PR was labeled with needs-qa)
  6. Add your team's label, i.e. label starting with team- (or external-contributor label if your not a MetaMask employee)

Description

The variable name network is used to refer to a network ID, network configuration, network type, network name, and various other things (sometimes even in the same file!). This can make it very difficult to understand what is happening, and it's a major obstacle to refactors of the network state.

Most network variables have been renamed to make it more clear what they refer to. Any instances of network that were part of data structures shared externally (e.g. metrics, provider state) were left alone, as were any cases that seemed too complicated to rename.

Issue

This relates to https://github.com/MetaMask/mobile-planning/issues/1015

Checklist

  • There is a related GitHub issue
  • Tests are included if applicable
  • Any added code is fully documented

@Gudahtt Gudahtt force-pushed the rename-ambiguous-network-variables branch from 932f977 to 6fcda0a Compare August 30, 2023 23:23
@Gudahtt Gudahtt added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Aug 30, 2023
@Gudahtt Gudahtt marked this pull request as ready for review August 30, 2023 23:23
@Gudahtt Gudahtt requested a review from a team as a code owner August 30, 2023 23:23
@Gudahtt
Copy link
Member Author

Gudahtt commented Aug 30, 2023

@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2023

Codecov Report

Patch coverage: 32.23% and project coverage change: +0.04% 🎉

Comparison is base (2a1a46a) 32.78% compared to head (6fcda0a) 32.83%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7089      +/-   ##
==========================================
+ Coverage   32.78%   32.83%   +0.04%     
==========================================
  Files        1001     1001              
  Lines       26710    26709       -1     
  Branches     2096     2096              
==========================================
+ Hits         8758     8769      +11     
+ Misses      17534    17524      -10     
+ Partials      418      416       -2     
Files Changed Coverage Δ
app/components/Nav/Main/index.js 6.87% <0.00%> (ø)
app/components/UI/AccountOverview/index.js 6.09% <0.00%> (ø)
.../UI/ApproveTransactionReview/AddNickname/index.tsx 7.01% <ø> (ø)
...pp/components/UI/ApproveTransactionReview/index.js 3.96% <0.00%> (ø)
app/components/UI/DrawerView/index.js 3.72% <0.00%> (ø)
app/components/UI/NetworkModal/index.tsx 4.54% <ø> (ø)
app/components/UI/ReceiveRequest/index.js 9.43% <ø> (ø)
app/components/Views/ApproveView/Approve/index.js 3.51% <ø> (ø)
...mponents/Views/NetworkSelector/NetworkSelector.tsx 65.15% <0.00%> (ø)
app/components/Views/Send/index.js 3.77% <0.00%> (ø)
... and 28 more

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

The variable name `network` is used to refer to a network ID, network
configuration, network type, network name, and various other things
(sometimes even in the same file!). This can make it very difficult to
understand what is happening, and it's a major obstacle to refactors of
the network state.

Most `network` variables have been renamed to make it more clear what
they refer to. Any instances of `network` that were part of data
structures shared externally (e.g. metrics, provider state) were left
alone, as were any cases that seemed too complicated to rename.

This relates to MetaMask/mobile-planning#1015
@Gudahtt Gudahtt force-pushed the rename-ambiguous-network-variables branch from a2b5481 to 105c8db Compare August 31, 2023 10:38
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@Cal-L Cal-L added No QA Needed/E2E Only Apply this label when your PR does not need any QA effort. and removed needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Aug 31, 2023
@sonarcloud
Copy link

sonarcloud bot commented Aug 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

25.9% 25.9% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@Gudahtt Gudahtt merged commit a474de9 into main Aug 31, 2023
13 checks passed
@Gudahtt Gudahtt deleted the rename-ambiguous-network-variables branch August 31, 2023 17:32
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2023
@metamaskbot metamaskbot added the release-7.7.0 Issue or pull request that will be included in release 7.7.0 label Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
No QA Needed/E2E Only Apply this label when your PR does not need any QA effort. release-7.7.0 Issue or pull request that will be included in release 7.7.0 team-mobile-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants