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

Templating variables and casing options #578

Merged
merged 3 commits into from
Mar 10, 2023
Merged

Templating variables and casing options #578

merged 3 commits into from
Mar 10, 2023

Conversation

LandonTClipp
Copy link
Collaborator

Description

This PR adds a few additional config options to the templating engine. The two variables added, along with their defaults, are:

structname: "Mock{{.InterfaceName}}"
outpkg: "{{.PackageName}}"

We also add more variables to the template namespace.

name description
InterfaceNameCamel Converts a string interface_name to InterfaceName
InterfaceNameLowerCamel Converts InterfaceName to interfaceName
InterfaceNameSnake Converts InterfaceName to interface_name

We delete the MockName template variable as this is not actually needed... mock names are controlled by the structname variable, and we set a default for that.

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 added

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

Sorry, something went wrong.

@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Patch coverage: 76.74419% and project coverage change: +0.43488 🎉

Comparison is base (b61e29c) 74.49438% compared to head (32917d4) 74.92926%.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master        #578         +/-   ##
===================================================
+ Coverage   74.49438%   74.92926%   +0.43487%     
===================================================
  Files              7           7                 
  Lines           1780        1767         -13     
===================================================
- Hits            1326        1324          -2     
+ Misses           367         358          -9     
+ Partials          87          85          -2     
Impacted Files Coverage Δ
pkg/outputter.go 34.09091% <75.60976%> (+0.58306%) ⬆️
pkg/config/config.go 71.17117% <100.00000%> (+0.26207%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@LandonTClipp LandonTClipp merged commit c96741b into vektra:master Mar 10, 2023
@LandonTClipp LandonTClipp deleted the interface_case branch March 10, 2023 00:54
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.

v2.21.6: packages config does not obey --case snake
1 participant