Skip to content

kelvin2kim/4156-Miniproject-2024-Students-Cplusplus

 
 

Repository files navigation

SETUP:

  • Used cpplint as the style checker tool for Google's C++ standard. After performing "pip install cpplint", I went over to IndividualMiniProject/src and ran the command "cpplint <file_name.cpp>" for each of the files I had. (Alternatively, "cpplint *") **cpplint currently outputs a warning for each code written, stating that I need to add copyright information at the top of the file. This has been cleared with a TA (Shivansh) that I can proceed without worrying about this.

  • Used clang-tidy as the static analysis tool for my code. Just from building and running the code, it is enabled by default. I performed "brew install llvm" first, then using one of the links I've referenced in README, I added the llvm/bin directory location to my PATH in .zshrc (export PATH="/usr/local/opt/llvm/bin:$PATH"). This allowed "clang-tidy" to be recognized by the system, and then I proceeded to add set_target_properties(IndividualMiniproject PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-checks=clang-analyzer-,bugprone-dangling-handle,bugprone-integer-division,bugprone-sizeof-expression,bugprone-string-integer-assignment,bugprone-undefined-memory-manipulation;-header-filter=^${CMAKE_SOURCE_DIR}/src/." ) to my CMakeLists.txt. Quick side note - I struggled for a while because running clang-tidy manually on my terminal for specific files worked fine, but it did not seem to change the outputs at all when I tried to build the executable using cmake. It turned out to be because I did not change any of the source files, so what I had to do was run the command "make clean" and then run "make" again from the build directory. Usage of clang-tidy slows down the build process, however. Feel free to remove this part from CMakeLists when building if you want it to be done faster.

  • Used gcc for coverage analysis

    1. pip install govr

    2. brew install gcc

    3. Navigate to build directory, then:

    4. cmake -DCMAKE_C_COMPILER=/opt/homebrew/bin/gcc-14 -DCMAKE_CXX_COMPILER=/opt/homebrew/bin/g++-14 ..

    5. make

    6. ./IndividualMiniproject setup (control + c after this command is run)

    7. ./IndividualMiniprojectTests

    gcovr --root ..
    --object-directory .
    --gcov-executable /opt/homebrew/bin/gcov-14
    --html --html-details
    -o coverage.html
    -v

    1. open coverage.html

    "rm -rf *" in the build directory for new builds if trying to run code coverage tests again.

    • Keep in mind that my mac is apple silicon, so the installation directories may differ if using an older model.
    • Note that for the coverage report, it includes branches that are in the scope of external functions that are included in std::istream, for example. The branch coverage that I focused on was on the code included in the original .cpp files that were provided with this assignment as well as the code I've written, such as if statements, loops, etc.

Doxygen: Nagivate to /html from the root directory, and run "open index.html" command (for mac)

Cloud deployment

  • More details of google cloud instance screenshot, as well as video of deployment and functionality is in gcp.txt
  • Note that this text file merely contains the relative path to the .png and .mov files of the screenshot and video that is already included in this repository.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 49.4%
  • C++ 48.7%
  • JavaScript 0.5%
  • C 0.4%
  • Python 0.3%
  • CSS 0.2%
  • Other 0.5%