Enforcing naming conventions with a custom codeAnalyzerConfiguration.json
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dani A
am 18 Aug. 2025
Beantwortet: Steven Lord
am 18 Aug. 2025
I'm using R2024b (24.2.0.2863752 (R2024b) Update 5), and I'm trying to implement the enforcement of naming conventions for methods, functions, etc. in my code base, so I've been referencing the configuring the code analyzer help page. I've just tried using the sample configuration as-is, and it appears that the code analyzer is not picking up on names which are non-compliant. See here this snippet for my class timeDomainSimulation.m:
classdef timeDomainSimulation
properties
model (1,1) cochlearModel
noiseStrength (1,1) double {mustBeNonnegative}
timeParams (1,1) timeDomainSimulationParameters
spectrum (1,1) welchSpectrum
end
end
I'm not entirely sure what's going on - when I used the matlab.codeanalysis.validateConfiguration function, it seemed to indicate that the "naming" field was invalid, but in all the documentation, it seems that this is what the name of the field is. I also tried changing the severity of "NOANS" and that seemed to work. I'm not sure if this a bug or if I'm just misunderstanding something
Thanks,
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 18 Aug. 2025
Compare the documentation page you linked (which is for the current release, which right now is release R2025a) with the version of that page from the release you're using, release R2024b. Nowhere on the R2024b version of the page does the word "naming" appear.
Looking at the Release Notes that mention "code analyzer", one of the entries in the release R2025a section (Code Analyzer: Configure Custom Naming Conventions for MATLAB identifiers) seems relevant.
So this doesn't seem to be a bug. You're just trying to use functionality that was introduced in a newer release than the one you're using.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!