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

Revert "Revert "Ban functions that exit the process (#5359)" (#5365)" #5403

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

rynowak
Copy link
Contributor

@rynowak rynowak commented Apr 5, 2023

This reverts commit 05f8c80.

Description

This change reverts the revert of previous PR #5359. The previous iteration broke the build and was reverted.

Issue reference

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Adds necessary unit tests for change
  • Adds necessary E2E tests for change
  • Unit tests passing
  • Extended the documentation / Created issue for it

@rynowak rynowak requested a review from a team as a code owner April 5, 2023 17:46
err := cmd.Execute()
if err != nil {
os.Exit(1) //nolint:forbidigo // this is OK inside the main function.
}
Copy link
Contributor Author

@rynowak rynowak Apr 5, 2023

Choose a reason for hiding this comment

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

This was the bug in the previous version that broke the build. It was if err == nil { os.Exit(1) }. Oops

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

60.5

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 60.5 %
  • main branch coverage: 60.6 %
  • diff coverage: -.1 %

The coverage result does not include the functional test coverage.

@rynowak
Copy link
Contributor Author

rynowak commented Apr 6, 2023

60.5

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

* Your PR branch coverage: 60.5 %

* main branch coverage: 60.6 %

* diff coverage: -.1 %

The coverage result does not include the functional test coverage.

@youngbupark what's the right thing to do when coverage goes down by 0.1% because of cosmetic changes? All my changes are in main() functions.

return nil, err
}

configFile, err := GetConfigFilePath(config)

Choose a reason for hiding this comment

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

This added code degraded the coverage.

@@ -137,15 +137,17 @@ func GetWorkspace(v *viper.Viper, name string) (*workspaces.Workspace, error) {
return section.GetWorkspace(name)

Choose a reason for hiding this comment

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

image

If you can add the test to validate the red block, you can pass the coverage rate.

for the detailed coverage report, you can go to Checks -> click Build and test -> download unit_test_coverage -> open html file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do I have to start writing tests unrelated to my change? This isn't something we should ask contributors to go through.

Choose a reason for hiding this comment

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

Why do I have to start writing tests unrelated to my change? This isn't something we should ask contributors to go through.

You're right. The right approach is that you need to add the unit-test for what you made below in config.go. I found that zero test for config. the test for config file would be trickier due to the file access so I gave you some workaround :) I agree that we should guide them to write the test for their change.

@@ -137,15 +137,17 @@ func GetWorkspace(v *viper.Viper, name string) (*workspaces.Workspace, error) {
return section.GetWorkspace(name)

Choose a reason for hiding this comment

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

Why do I have to start writing tests unrelated to my change? This isn't something we should ask contributors to go through.

You're right. The right approach is that you need to add the unit-test for what you made below in config.go. I found that zero test for config. the test for config file would be trickier due to the file access so I gave you some workaround :) I agree that we should guide them to write the test for their change.

config := getConfig(configFilePath)
configFile := GetConfigFilePath(config)
config, err := getConfig(configFilePath)
if err != nil {

Choose a reason for hiding this comment

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

These ifs degraded the coverage.

@github-actions
Copy link

61.5

For the detailed report, please go to Checks tab, click Build and Test, and then download unit_test_coverage artifact at the bottom of build page.

  • Your PR branch coverage: 61.5 %
  • main branch coverage: 61.5 %
  • diff coverage: 0 %

The coverage result does not include the functional test coverage.

cmd/applink-rp/main.go Show resolved Hide resolved
@rynowak rynowak merged commit eac853e into main Apr 24, 2023
@rynowak rynowak deleted the rynowak/linters branch April 24, 2023 23:49
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.

3 participants