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

[Feature] Add new string template functions #705

Merged
merged 5 commits into from
Oct 4, 2023

Conversation

SirSova
Copy link
Contributor

@SirSova SirSova commented Sep 18, 2023

List of new funcs:

  • lower
  • upper
  • camelcase
  • snakecase
  • kebabcase
  • firstLower
  • firstUpper

change the dependency for strings ops "iancoleman/strcase" -> "huandu/xstrings"

deprecate the custom "InterfaceName" template variables

Description

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?

Unit tests. Build and run mockery with new functions applied to a template locally.

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

list of funcs:
- lower
- upper
- title
- camelcase
- snakecase
- kebabcase
- firstLower
- firstUpper

change the dependency for strings ops "iancoleman/strcase" -> "huandu/xstrings"
@SirSova SirSova changed the title Add new string template functions [Feature] Add new string template functions Sep 18, 2023
@SirSova
Copy link
Contributor Author

SirSova commented Sep 18, 2023

@LandonTClipp please review the PR, cuz I can't edit Reviewers section.

pkg/outputter.go Outdated
Comment on lines 225 to 227
InterfaceNameCamel: xstrings.ToCamelCase(iface.Name),
InterfaceNameLowerCamel: xstrings.FirstRuneToLower(xstrings.ToCamelCase(iface.Name)),
InterfaceNameSnake: xstrings.ToSnakeCase(iface.Name),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this have any behavior differences or are they strictly equivalent? I'm inclined to keep the old package populating these variables and just remove them in v3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as far as I see, they behave absolutely the same.
But since they are deprecated I guess it's okay to keep code unchanged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (72c48ed) 74.89121% compared to head (8b0b6a3) 74.88090%.
Report is 11 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master        #705         +/-   ##
===================================================
- Coverage   74.89121%   74.88090%   -0.01032%     
===================================================
  Files              9           9                 
  Lines           2298        2309         +11     
===================================================
+ Hits            1721        1729          +8     
- Misses           440         442          +2     
- Partials         137         138          +1     
Files Coverage Δ
pkg/outputter.go 65.31532% <100.00000%> (+0.31531%) ⬆️

... and 1 file with indirect coverage changes

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

Copy link
Collaborator

@LandonTClipp LandonTClipp left a comment

Choose a reason for hiding this comment

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

Great!

LandonTClipp

This comment was marked as duplicate.

@LandonTClipp LandonTClipp merged commit 6c20c91 into vektra:master Oct 4, 2023
4 of 5 checks passed
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.

2 participants