Am trying to do a code review using openAI chatgpt 4 model using API having temprature as 0 with provided guide lines and prompt , But model is not generating comments against proper line number , which will help to add the comment back to bitbucket.
Sample gitdiff
diff --git a/src/Gzip.h b/src/Gzip.h
index 5a4e4f9…ae2ebf1 100644
— a/src/Gzip.h
+++ b/src/Gzip.h
@@ -11,20 +11,26 @@
- Created on September 11, 2019, 1:22 PM
*/
-#ifndef GZIP_H
-#define GZIP_H
+//#ifndef GZIP_H
+//#define GZIP_H
#include
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
-class Gzip {
+class gzip {
public:
-
static std::string compress(const std::string& data);
-
static std::string decompress(const std::string& data);
- void recurse(long iIndex);
-
long returnValueTest();
- static std::string Decompress(const std::string& data);
-
static std::string Compress(const std::string& data);
- static bool compareStrings(const std::string& str1, const std::string& str2);
+private:
- int iIndex;
};
-#endif /* GZIP_H /
+//#endif / GZIP_H */
And below is the prompt used
Act as a C++ code reviewer.
Review only .cpp .hpp .c and .h file extensions
Do not review the code with is removed , add comments only the new code added
Provide output in json format with entire file path name as a parent key having exact line number as child key with comment.
Display total number of review comments at the top with key total_comments.
Provide review comments along with the corrective action against proper line n only for the violations
Make sure to add the entire file path name in json and avoid using relative file path name.
Below is sample json which is expected
{“total_comments”: 1, “”: {“”: “”}
Guidelines
The output generated is
{
“total_comments”: 4,
“/src/Gzip.h”: {
“11”: “Include guards are commented out. They should be used to prevent multiple inclusions.”,
“13”: “Prefer ‘using’ over typedef for type aliasing in modern C++.”,
“19”: “Class member ‘iIndex’ should be prefixed with ‘m_’ to follow naming conventions.”,
“21”: “Avoid using fully qualified names like ‘std::string’ in header files, prefer including the necessary headers.”
}
}