Write Only Property

Warns about properties that don't expose a 'Property Get' accessor.

Reasoning

Write-only properties are suspicious: if the client code is able to set a property, it should be allowed to read that property as well. Class design guidelines and best practices generally recommend against write-only properties.

Default severity

Suggestion

Inspection type

CodeQualityIssues

Examples

This example should trigger a result

MyModule (StandardModule)
Private internalFoo As Long Public Property Let Foo(ByVal value As Long) internalFoo = value End Property

This example should NOT trigger a result

MyModule (StandardModule)
Private internalFoo As Long Public Property Let Foo(ByVal value As Long) internalFoo = value End Property Public Property Get Foo() As Long Foo = internalFoo End Property

Rubberduck.CodeAnalysis.Inspections.Concrete.WriteOnlyPropertyInspection.cs (Prerelease-v2.5.9.6289)