Skip to content

Refactor daemon.info to reduce cyclomatic complexity#37451

Merged
tiborvass merged 2 commits intomoby:masterfrom
thaJeztah:refactor_system_info
Jul 13, 2018
Merged

Refactor daemon.info to reduce cyclomatic complexity#37451
tiborvass merged 2 commits intomoby:masterfrom
thaJeztah:refactor_system_info

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

Today's "Lunch time special!"

Before this change;

gocyclo daemon/info.go
17 daemon (*Daemon).SystemInfo daemon/info.go:27:1
2 daemon (*Daemon).SystemVersion daemon/info.go:150:1
1 daemon (*Daemon).showPluginsInfo daemon/info.go:195:1

After this change;

gocyclo daemon/info.go
8 daemon (*Daemon).fillSecurityOptions daemon/info.go:150:1
5 daemon operatingSystem daemon/info.go:201:1
3 daemon (*Daemon).fillDriverInfo daemon/info.go:121:1
2 daemon hostName daemon/info.go:172:1
2 daemon memInfo daemon/info.go:192:1
2 daemon kernelVersion daemon/info.go:182:1
1 daemon (*Daemon).SystemVersion daemon/info.go:81:1
1 daemon (*Daemon).SystemInfo daemon/info.go:27:1
1 daemon (*Daemon).fillPluginsInfo daemon/info.go:138:1

Before this change;

    gocyclo daemon/info.go
    17 daemon (*Daemon).SystemInfo daemon/info.go:27:1
    2 daemon (*Daemon).SystemVersion daemon/info.go:150:1
    1 daemon (*Daemon).showPluginsInfo daemon/info.go:195:1

After this change;

    gocyclo daemon/info.go
    8 daemon (*Daemon).fillSecurityOptions daemon/info.go:150:1
    5 daemon operatingSystem daemon/info.go:201:1
    3 daemon (*Daemon).fillDriverInfo daemon/info.go:121:1
    2 daemon hostName daemon/info.go:172:1
    2 daemon memInfo daemon/info.go:192:1
    2 daemon kernelVersion daemon/info.go:182:1
    1 daemon (*Daemon).SystemVersion daemon/info.go:81:1
    1 daemon (*Daemon).SystemInfo daemon/info.go:27:1
    1 daemon (*Daemon).fillPluginsInfo daemon/info.go:138:1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Copy link
Copy Markdown
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐸

Comment thread daemon/info.go
}

func kernelVersion() string {
kernelVersion := "<unknown>"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

FWIW; I don't like these <unknown> values; they should be in the CLI, not in the API, but that would need some discussion (for backward compatibility)

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 13, 2018

Codecov Report

Merging #37451 into master will decrease coverage by <.01%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master   #37451      +/-   ##
==========================================
- Coverage   34.95%   34.94%   -0.01%     
==========================================
  Files         610      610              
  Lines       44875    44881       +6     
==========================================
- Hits        15685    15683       -2     
- Misses      27071    27077       +6     
- Partials     2119     2121       +2

Copy link
Copy Markdown
Contributor

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

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

LGTM

@tiborvass tiborvass merged commit a2a1d04 into moby:master Jul 13, 2018
@thaJeztah thaJeztah deleted the refactor_system_info branch July 13, 2018 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants