CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

Static Analysis Naming Warnings
https://forum.codesys.com/viewtopic.php?f=20&t=6807
Page 1 of 1

Author:  DavidCozens [ Mon Mar 28, 2016 1:36 pm ]
Post subject:  Static Analysis Naming Warnings

I am in the process of cleaning up an IO driver to make it available in the codesys store. As part of this process all libraries are supposed to comply with a pre-defined set of static analysis rules including naming conventions.
There are standard interfaces that do not comply with the naming conventions and so give static analysis failures. e.g. from IoDrvUpdateConfiguration I get:
Quote:
NC0015: Invalid variable name 'nCount'. Expected prefix 'di'

Looking at the documentation for static analysis I find that I can suppress this warning using
Code:
{attribute 'naming' := 'omit'}

This does suppress the warning, however I now get a compiler warning
Quote:
C0351: The attribute naming is unknown and will be ignored by the compiler.

I have tried disabling the compiler warning using
Code:
{warning disable C0351}

however this has no effect.
Please advise how I can write code that fulfils this standard interface, satisfies your standard static analysis rules, and does not throw compiler warnings?
To be honest I would prefer it if static analysis didn't complain at all about function blocks implementing an interface. It is a waste of time going and adding suppressions in the implementing function block. Raising the static analysis warning where the interface is defined makes sense, but not where it is implemented. Perhaps a JIRA entry could be raised to make this improvement. This may seem a trivial request, static analysis can be a great tool to improve readability and quality, but not if it wastes time on code that the developer cannot fix.

Author:  TimvH [ Tue Apr 26, 2016 6:22 pm ]
Post subject:  Re: Static Analysis Naming Warnings

Hi David,

I had a similar problem.
The attribute "naming" should be recognized, but isn't. This is a bug in 3.5 SP8 and hasn't been fixed yet.

The jira issue is CDS-47159.

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/