casbin-cpp
casbin-cpp copied to clipboard
Contribution guide
- Our build system is makefile (on Linux) & Visual Studio project files (on Windows). We don't use cross-platform building tools like CMake because I think it only makes things more complicated. Just maintaining two native build systems (makefile and Visual Studio) is easier and more friendly to users. Casbin is a library instead of app, so I must choose something used more widely. Please make your code compile well on both platforms before any PR. I personally will test the code on Visual Studio and CLion on Windows.
- We use Google test as the test framework.
3. Use
use namespace std;
, there should be nostd::string
in the code. [Abandoned] - The allowed source file name's extensions are
.cpp
and.h
. Others like.cc
,.hpp
are forbidden. - Write minimized working code first, like file adapter, model, enforcer. Don't try to setup a code framework, or something like CI, linter only. I cannot witness those things work well without concrete code.
- Use
printf
instead ofcout
. Nocout
will be allowed in the code. - Follow the module (filename) naming of Golang Casbin: https://github.com/casbin/casbin . Do not invent a name by yourself.
- Your code in PR should compile well itself on Windows and Linux, better with tests. Do not leave a feature in half, which has 100+ compile errors and then send PR.
- Base your code on our latest master branch, follow our folder structure, filename naming, etc.
- Do not use CMake or any cross-platform building tools (I have to say it again).
- Don't commit so many code in one PR. One PR can only contain one commit, with 100 LoC change.
- Other things please follow Google C++ Style Guide: https://google.github.io/styleguide/cppguide.html
Will follow this conventions.
@hsluoyz Thanks for this. This will be surely followed.
Get the point,this rule will be precisely followed
- Use
use namespace std;
, there should be nostd::string
in the code. The problem with putting using namespace in the header files of your classes is that it forces anyone who wants to use your classes (by including your header files) to also be 'using' (i.e. seeing everything in) those other namespaces. However, you may feel free to put a using statement in your (private) *.cpp files. See also: https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
Another thing to consider is adding namespaces to your project, e.g. namespace casbin { .. } in each file. This will prevent conflicts with other projects.