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

Method naming applied to setters and getters leads to false positives #287

Open
pvogt09 opened this issue Apr 11, 2024 · 0 comments
Open

Comments

@pvogt09
Copy link

pvogt09 commented Apr 11, 2024

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).

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

No branches or pull requests

1 participant