红联Linux门户
Linux帮助

SonarQube C/C++/Objective C 4.1发布

发布时间:2016-08-25 22:52:33来源:红联作者:baihuo
SonarQube C/C++/Objective C 4.1 发布了,Sonar (SonarQube)是一个开源平台,用于管理源代码的质量。Sonar 不只是一个质量数据报告工具,更是代码质量管理平台。支持的语言包括:Java、PHP、C#、C、Cobol、PL/SQL、Flex 等。本次发布更新如下:

“catch” clauses should do more than rethrow (C++, Objective-C , Code Smell, cert, clumsy, finding, unused)

Atomic types should be used instead of “volatile” types (C++, C, Objective-C, Bug, c11, cert, cpp11, multi-threading)

Casts should not remove “const” or “volatile” qualifications from the type (C++, Bug, cert, misra, suspicious)

Comparison operators should not be virtual (C++, Code Smell, pitfall)

Declaration specifiers should not be redundant (C++, C, Objective-C, Bug, redundant)

Exceptions should not be ignored (C++, Objective-C, Bug, cwe, error-handling, suspicious)

Generic exceptions should never be thrown (C++, Bug, cert, cwe, error-handling)

Generic exceptions should not be caught (C++, Bug, cert, cwe, error-handling)

Non-exception types should not be caught (C++, Code Smell, error-handling)

Non-exception types should not be thrown (C++, Bug, error-handling, misra)

Partial specialization syntax should not be used for function templates (C++, Code Smell, lock-in)

Pure “virtual” functions should not override non-pure “virtual” functions (C++, Code Smell, misra, pitfall)
Example of an issue found in the Clang source code:
pure_virtual_function
Indeed here is the inheritance hierarchy :
class ASTConsumer { public: virtual void Initialize(ASTContext &Context) {} };
class RewriteObjC : public ASTConsumer { public: void Initialize(ASTContext &context) override = 0; };
class RewriteObjCFragileABI : public RewriteObjC { public: virtual void Initialize(ASTContext &context); };

And so the function body of RewriteObjCFragileABI::Initialize(...) don’t start by callingRewriteObjC::Initialize(...), because it’s a pure virtual function that can’t be called, and don’t either call ASTConsumer::Initialize(...) because it’s unexpected to have a pure virtual function that override one with an implementation. So now, with this design, if some initialization code is added in ASTConsumer::Initialize(...) it will not be called from RewriteObjCFragileABI object.

String literals should not be immediately followed by macros (C++, Code Smell, cpp11, lock-in)

了解更多信息,查看发布说明:

https://jira.sonarsource.com/secure/ReleaseNote.jspa?projectId=10090&version=13324

http://www.sonarsource.com/2016/08/25/sonarqube-ccobjective-c-4-1-released/

下载:

http://www.sonarqube.org/downloads/

来自:开源中国社区
文章评论

共有 0 条评论