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

[init refactor] introducing init analyzers #3533

Merged
merged 2 commits into from Jan 20, 2020

Conversation

balopat
Copy link
Contributor

@balopat balopat commented Jan 20, 2020

Refactoring - shouldn't change anything functionally.
Introducing analyzers in the initializer package.

An Analyzer is basically implementing a Visitor pattern, can react to EnterDir and ExitDir events and can be called on each file. This creates a more composable design that is open for extension but closed for modification.

Also added tests to cover config generation logic.

@balopat balopat changed the title introducing init analyzers [init refactor] introducing init analyzers Jan 20, 2020
@codecov
Copy link

codecov bot commented Jan 20, 2020

Codecov Report

Merging #3533 into master will increase coverage by 0.24%.
The diff coverage is 62.65%.

Impacted Files Coverage Δ
pkg/skaffold/initializer/builders.go 92.85% <ø> (+8.3%) ⬆️
pkg/skaffold/initializer/init.go 0% <0%> (-29.13%) ⬇️
pkg/skaffold/initializer/prompt.go 0% <0%> (ø)
pkg/skaffold/initializer/config.go 100% <100%> (ø)
pkg/skaffold/initializer/analyze.go 89.09% <89.09%> (ø)

@balopat balopat force-pushed the init_refactor/analyzers branch 2 times, most recently from 98a28f7 to 15e12ca Compare January 20, 2020 07:33
Copy link
Contributor

@dgageot dgageot 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 to me with a few nits

)

type analysis struct {
kubectlAnalyzer *KubectlAnalyzer
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these three types need to be exposed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, they don't!

pkg/skaffold/initializer/analyze.go Outdated Show resolved Hide resolved
pkg/skaffold/initializer/analyze.go Outdated Show resolved Hide resolved
pkg/skaffold/initializer/analyze.go Outdated Show resolved Hide resolved
pkg/skaffold/initializer/builders.go Outdated Show resolved Hide resolved
pkg/skaffold/initializer/config_test.go Show resolved Hide resolved
@dgageot dgageot self-assigned this Jan 20, 2020
@balopat
Copy link
Contributor Author

balopat commented Jan 20, 2020

Thanks for the quick review! I'll fix the nits tomorrow morning!:)

@balopat balopat merged commit 99870a8 into GoogleContainerTools:master Jan 20, 2020
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.

None yet

3 participants