Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cxx-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,10 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public void visitToken(Token token) {
&& !trivia.getToken().getOriginalValue().startsWith("///")
&& !trivia.getToken().getOriginalValue().startsWith("//!")
&& !trivia.getToken().getOriginalValue().startsWith("/**")
&& !trivia.getToken().getOriginalValue().startsWith("/*!")) {
&& !trivia.getToken().getOriginalValue().startsWith("/*!")
&& !trivia.getToken().getOriginalValue().startsWith("/*@")
&& !trivia.getToken().getOriginalValue().startsWith("//@")) {
String lines[] = regexpToDivideStringByLine.split(getContext().getCommentAnalyser().getContents(
trivia.getToken().getOriginalValue()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.UnsupportedEncodingException;

import org.junit.Rule;
import org.junit.Test;
import org.sonar.cxx.CxxAstScanner;
import org.sonar.squidbridge.api.SourceFile;
import org.sonar.squidbridge.checks.CheckMessagesVerifierRule;
Expand All @@ -32,7 +33,7 @@ public class CommentedCodeCheckTest {
@Rule
public CheckMessagesVerifierRule checkMessagesVerifier = new CheckMessagesVerifierRule();

// @Test
@Test
public void test() throws UnsupportedEncodingException, IOException {
CxxFileTester tester = CxxFileTesterHelper.CreateCxxFileTester("src/test/resources/checks/commentedCode.cc", ".");
SourceFile file = CxxAstScanner.scanSingleFile(tester.cxxFile, tester.sensorContext, new CommentedCodeCheck());
Expand Down
134 changes: 131 additions & 3 deletions cxx-checks/src/test/resources/checks/commentedCode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,139 @@ class Program
}
};

int main( int argc, char * argv[] )
/** @defgroup group1 The First Group
* This is the first group
* @{
*/

/** @brief class C1 in group 1 */
class C1 {};

/** @brief class C2 in group 1 */
class C2 {};

/** function in group 1 */
void func() {}

/** @} */ // end of group1

/**
* @defgroup group2 The Second Group
* This is the second group
*/

/** @defgroup group3 The Third Group
* This is the third group
*/

/** @defgroup group4 The Fourth Group
* @ingroup group3
* Group 4 is a subgroup of group 3
*/

/**
* @ingroup group2
* @brief class C3 in group 2
*/
class C3 {};

/** @ingroup group2
* @brief class C4 in group 2
*/
class C4 {};

/** @ingroup group3
* @brief class C5 in @link group3 the third group@endlink.
*/
class C5 {};

/** @ingroup group1 group2 group3 group4
* namespace N1 is in four groups
* @sa @link group1 The first group@endlink, group2, group3, group4
*
* Also see @ref mypage2
*/
namespace N1 {};

/** @file
* @ingroup group3
* @brief this file in group 3
*/

/** @defgroup group5 The Fifth Group
* This is the fifth group
* @{
*/

/** @page mypage1 This is a section in group 5
* Text of the first section
*/

/** @page mypage2 This is another section in group 5
* Text of the second section
*/

/** @} */ // end of group5

/** @addtogroup group1
*
* More documentation for the first group.
* @{
*/

/** another function in group 1 */
void func2() {}

/** yet another function in group 1 */
void func3() {}

/** @} */ // end of group1

/** A class. Details */
class Memgrp_Test
{
return 0;
}
public:
//@{
/** Same documentation for both members. Details */
void func1InGroup1();
void func2InGroup1();
//@}

/** Function without group. Details. */
void ungroupedFunction();
void func1InGroup2();
protected:
void func2InGroup2();
};

void Memgrp_Test::func1InGroup1() {}
void Memgrp_Test::func2InGroup1() {}

/** @name Group2
* Description of group 2.
*/
///@{
/** Function 2 in group 2. Details. */
void Memgrp_Test::func2InGroup2() {}
/** Function 1 in group 2. Details. */
void Memgrp_Test::func1InGroup2() {}
///@}

/*! \file
* docs for this file
*/

//!@{
//! one description for all members of this group
//! (because DISTRIBUTE_GROUP_DOC is YES in the config file)
#define A 1
#define B 2
void glob_func();
//!@}


int main( int argc, char * argv[] )
{
return 0;
}