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

Add error log for unsupported config #686

Merged
merged 1 commit into from Aug 4, 2023

Conversation

LandonTClipp
Copy link
Contributor

@LandonTClipp LandonTClipp commented Aug 4, 2023

Description

This commit will log an error message if unsupported config is being used. I have chosen not to cause mockery to return an error code because it's possible that configs using unsupported parameters are working just fine, so we don't want to break those users. Instead, the log message should hopefully get their attention, and the attention of anyone trying to migrate to packages. Also removed is the conditional used to enter into the packages code path. Previously it asserted that Config.Name == "" but this was causing more confusion than it needed to.

This fixes #685

Screenshot 2023-08-04 at 3 33 36 PM

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Version of Golang used when building/testing:

  • 1.11
  • 1.12
  • 1.13
  • 1.14
  • 1.15
  • 1.16
  • 1.17
  • 1.18
  • 1.19
  • 1.20

How Has This Been Tested?

Manual tests

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Patch coverage: 24.32432% and project coverage change: -0.86418% ⚠️

Comparison is base (2046503) 75.36880% compared to head (d7818e4) 74.50462%.

❗ Current head d7818e4 differs from pull request most recent head 72eb146. Consider uploading reports for the commit 72eb146 to get more accurate results

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master        #686         +/-   ##
===================================================
- Coverage   75.36880%   74.50462%   -0.86418%     
===================================================
  Files              9           9                 
  Lines           2237        2271         +34     
===================================================
+ Hits            1686        1692          +6     
- Misses           414         442         +28     
  Partials         137         137                 
Files Changed Coverage Δ
pkg/config/config.go 67.41155% <6.66667%> (-3.59437%) ⬇️
cmd/mockery.go 59.20245% <100.00000%> (+0.25182%) ⬆️
pkg/outputter.go 63.31878% <100.00000%> (+0.32318%) ⬆️

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

This commit will log an error message if unsupported config is being used. I have chosen not to cause mockery to return an error code because it's possible that configs using unsupported parameters are working just fine, so we don't want to break those users. Instead, the log message should hopefully get their attention, and the attention of anyone trying to migrate to packages. Also removed is the conditional used to enter into the `packages` code path. Previously it asserted that `Config.Name == ""` but this was causing more confusion than it needed to.

This fixes vektra#685
@LandonTClipp LandonTClipp merged commit 8abb702 into vektra:master Aug 4, 2023
3 of 5 checks passed
@LandonTClipp LandonTClipp deleted the issue_685 branch August 4, 2023 22:06
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.

Make mockery fail with explicit error messages when using unsupported config
1 participant