8000 Fix gocyclo lint error for internal/lvmd by toshipp · Pull Request #1001 · topolvm/topolvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix gocyclo lint error for internal/lvmd #1001

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

Merged
merged 12 commits into from
Jan 23, 2025
Merged

Conversation

toshipp
Copy link
Contributor
@toshipp toshipp commented Dec 20, 2024

issue: #853

@toshipp toshipp force-pushed the fix-gocyclo-lvmd branch 2 times, most recently from eb4f9a0 to 58a5c18 Compare December 20, 2024 09:20
@toshipp toshipp force-pushed the fix-gocyclo-lvmd branch 4 times, most recently from 06679bd to 63080a8 < 8000 a href="/topolvm/topolvm/compare/06679bdd77b1c95fd2824d03c85a943fb6ebb6f1..63080a8a53b50cb4995e0a3febecbe8ed2b17b9e" data-hydro-click="{"event_type":"force_push_timeline_diff.click","payload":{"pull_request_id":2246296505,"repository_id":183557088,"event_id":15916122329,"originating_url":"https://github.com/topolvm/topolvm/pull/1001","user_id":null}}" data-hydro-click-hmac="ae0d96139f10b72fd901b955f013f48e9d174abe1ec0b13723b5c25fc678ff21" data-view-component="true" class="Button--invisible Button--small Button Button--invisible-noVisuals float-right ml-2"> Compare January 14, 2025 02:22
The struct is defined in lvm.go, so tests should be in lvm_test.go.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
These assertions are already tested on the Thin volume test cases. To
reduce cyclomatic complexity, delete them.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
@toshipp toshipp force-pushed the fix-gocyclo-lvmd branch 4 times, most recently from 034b4b4 to 05ba7cb Compare January 16, 2025 09:48
@toshipp toshipp marked this pull request as ready for review January 20, 2025 02:10
@toshipp toshipp requested a review from a team as a code owner January 20, 2025 02:10
peng225
peng225 previously approved these changes Jan 20, 2025
Copy link
Member
@satoru-takeuchi satoru-takeuchi left a comment

Choose a reason for hiding this comment

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

Almost all changes looks file. Just one minor nit.

return lvService, &count, vg, pool
}

func TestLVService_TickLV(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func TestLVService_TickLV(t *testing.T) {
func TestLVService_ThickLV(t *testing.T) {

To improve readability and conform to the gocyclo lint, split these tests.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
As it tests the Watch method and LV operations using a subtest, it
should be dedicated tests.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
It is because it has been a TODO for a long time.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
It is not related to VGService, but to VolumeGroup.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
It is not related to VGService.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
This reduces cyclomatic complexity and improves readability.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Using subtest is more readable than comments.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
There are two tests for thick and thin and they are almost same. To
improve readability, use table test to dedup them.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
This attemps to improve readability and reduce cyclomatic complexity.

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
@satoru-takeuchi satoru-takeuchi merged commit 6334d56 into main Jan 23, 2025
24 checks passed
@satoru-takeuchi satoru-takeuchi deleted the fix-gocyclo-lvmd branch January 23, 2025 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants
0