Skip to content

Commit

Permalink
Add deprecation for structname.
Browse files Browse the repository at this point in the history
Resolves vektra#844.
  • Loading branch information
LandonTClipp committed Jan 14, 2025
1 parent 7df0754 commit 9d2a002
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Parameter Descriptions
| `print` | :fontawesome-solid-x: | `#!yaml false` | Use `print: True` to have the resulting code printed out instead of written to disk. |
| [`recursive`](features.md#recursive-package-discovery) | :fontawesome-solid-x: | `#!yaml false` | When set to `true` on a particular package, mockery will recursively search for all sub-packages and inject those packages into the config map. |
| [`replace-type`](features.md#replace-types) | :fontawesome-solid-x: | `#!yaml null` | Replaces aliases, packages and/or types during generation. |
| `resolve-type-alias` | :fontawesome-solid-x: | `#!yaml False` | Set to `True` if you would like mockery to resolve type aliases to their underlying type. In most cases, you do not want to resolve type aliases as it can break references to internal/private names. |
| `tags` | :fontawesome-solid-x: | `#!yaml ""` | A space-separated list of additional build tags to load packages. |
| [`with-expecter`](features.md#expecter-structs) | :fontawesome-solid-x: | `#!yaml true` | Use `with-expecter: True` to generate `EXPECT()` methods for your mocks. This is the preferred way to set up your mocks. |

Expand Down
17 changes: 16 additions & 1 deletion docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ The `--quiet` parameter is superseded by `--log-level=""`. It will be removed in

`disable-version-string`
-----------------------

!!! tip ""

To resolve this warning:
Expand All @@ -115,4 +116,18 @@ The `--quiet` parameter is superseded by `--log-level=""`. It will be removed in
disable-version-string: True
```

Mockery will no longer print the version of mockery used as a comment in the mock files.
Mockery will no longer print the version of mockery used as a comment in the mock files.

`structname`
------------

!!! tip ""

To resolve this warning:

```yaml title=".mockery.yaml"
structname: ""
mockname: "NameOfMock"
```

If you're receiving this warning, you are likely not using the `packages` config feature anyway. It should be noted that `structname` will not be a config option in v3. Receipt of this warning means you need to upgrade to use the `packages` config feature.
8 changes: 8 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,4 +861,12 @@ func (c *Config) LogDeprecatedConfig(ctx context.Context) {
nil,
)
}
if c.StructName != "" {
logging.WarnDeprecated(
ctx,
"structname",
"structname will be removed as a parameter in v3",
nil,
)
}
}

0 comments on commit 9d2a002

Please sign in to comment.