更新“应返回该私有数值的副本”准则

master
renfengshan 10 months ago
parent b4147782d6
commit 423d63d4f2
  1. 2
      sonar-keyware-plugins-cxx/src/test/java/com/keyware/sonar/cxx/rules/checkers/NumericalCopyTest.java
  2. 8
      sonar-keyware-plugins-cxx/src/test/resources/com/keyware/sonar/cxx/rules/checkers/NumericalCopyChecker.cc

@ -23,7 +23,7 @@ public class NumericalCopyTest {
SourceFile file = CxxAstScanner.scanSingleInputFile(tester.asInputFile(), checker);
CheckMessagesVerifier.verify(file.getCheckMessages())
.next().atLine(15).withMessage("应返回该私有数值的副本")
.next().atLine(25).withMessage("应返回该私有数值的副本")
.next().atLine(20).withMessage("应返回该私有数值的副本")
.noMore();
}

@ -15,14 +15,8 @@ public:
return privateArray; // error
}
// 返回的是私有数组的副本
// int getPrivateArrayPtr() {
// return privateArray.data();
// }
// 返回的是私有数组的指针
int* getPrivateArrayPtr() {
return privateArray.data(); // error
}
};
}
Loading…
Cancel
Save