<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Static Analysis Naming Warnings</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d1b637098c/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d1b637098c/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/d1b637098c/</id><updated>2020-02-27T15:04:48.487000Z</updated><subtitle>Recent posts to Static Analysis Naming Warnings</subtitle><entry><title>Static Analysis Naming Warnings</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d1b637098c/?limit=25#6cea" rel="alternate"/><published>2020-02-27T15:04:48.487000Z</published><updated>2020-02-27T15:04:48.487000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com2fc2736bf0c73fa3dd0e1766b05cdb65637acfe1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi David,&lt;/p&gt;
&lt;p&gt;I had a similar problem.&lt;br/&gt;
The attribute "naming" should be recognized, but isn't. This is a bug in 3.5 SP8 and hasn't been fixed yet.&lt;/p&gt;
&lt;p&gt;The jira issue is CDS-47159.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Static Analysis Naming Warnings</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d1b637098c/?limit=25#f429" rel="alternate"/><published>2020-02-27T15:04:47.844000Z</published><updated>2020-02-27T15:04:47.844000Z</updated><author><name>DavidCozens</name><uri>https://forge.codesys.com/u/davidcozens/</uri></author><id>https://forge.codesys.com1d7eb262b0be6f80affc353606b5c9d4a38f28d0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;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.&lt;br/&gt;
There are standard interfaces that do not comply with the naming conventions and so give static analysis failures. e.g. from IoDrvUpdateConfiguration I get:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
NC0015: Invalid variable name 'nCount'. Expected prefix 'di'&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Looking at the documentation for static analysis I find that I can suppress this warning using&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;&lt;span class="n"&gt;attribute&lt;/span&gt; &lt;span class="s1"&gt;'naming'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'omit'&lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This does suppress the warning, however I now get a compiler warning&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
C0351: The attribute naming is unknown and will be ignored by the compiler.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I have tried disabling the compiler warning using&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;&lt;span class="n"&gt;warning&lt;/span&gt; &lt;span class="n"&gt;disable&lt;/span&gt; &lt;span class="n"&gt;C0351&lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;however this has no effect.&lt;br/&gt;
Please advise how I can write code that fulfils this standard interface, satisfies your standard static analysis rules, and does not throw compiler warnings?&lt;br/&gt;
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.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>