miss_hit
miss_hit copied to clipboard
Method naming applied to setters and getters leads to false positives
MISS_HIT Component affected Please choose one from:
- Style checker
Your MATLAB/Octave environment
- MATLAB
- R2023B
Your operating system and Python version
- Linux
- python 3.8.10
Describe the bug Running the style checker on
classdef Setter < handle
properties (SetAccess = private)
Attribute
end
methods
function set.Attribute(this, attribute)
this.Attribute = attribute;
end
end
end
results in a style violation
In Setter.m, line 8
| function set.Attribute(this, attribute)
| ^^^^^^^^^^style: violates naming scheme for method [naming_functions]
being reported when using a default settings that should not be reported because there are no style restrictions on attributes imposed.
set.*
and get.*
methods have to contain the name of the attribute to work at all, so they should be treated differently compared to normal methods. Maybe a special naming scheme parameter for class attributes could be introduced to take this into account or the part after the dot could be checked against the names of the attributes the class has (although this might not work well with inheritance in case the parent class is not available).