Skip to content

Commit

Permalink
chore: Cleanup comments (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric15342335 authored Jun 10, 2024
1 parent c6289e2 commit 9ebc8e0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 78 deletions.
2 changes: 0 additions & 2 deletions .github/Doxyfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Doxygen configuration file for Stock Market Simulator
PROJECT_NAME = "Stock Market Simulator"
INPUT = . src/ include/
BUILTIN_STL_SUPPORT = YES
Expand Down Expand Up @@ -29,7 +28,6 @@ LATEX_BATCHMODE = YES
LOOKUP_CACHE_SIZE = 9
NUM_PROC_THREADS = 16
DOT_NUM_THREADS = 16
# GENERATE_HTMLHELP = YES
SITEMAP_URL = https://eric15342335.github.io/comp2113-engg1340-group-project/
DOT_MULTI_TARGETS = YES
PROJECT_BRIEF = A game that provides a realistic stock buying experience with unpredictable trends to test investment strategies.
Expand Down
47 changes: 2 additions & 45 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ name: CI
on:
[push, workflow_dispatch]

#concurrency:
# group: "make"
# cancel-in-progress: false

jobs:
build-and-test:
# runs-on: self-hosted
timeout-minutes: 5
timeout-minutes: 10
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -119,9 +114,7 @@ jobs:
fi
echo -e "1\ntest\nX\nY\n" | ./$executable
echo -e "0\n saves\nsaves\nB\n1\n1\nN\nY\nN\nY\nN\nY\nT\n0\nT\n1\nT\n2\nE\nT\nX\nY\n" | ./$executable
# test for loading saves
echo -e "1\nsaves\nN\nY\nN\nY\nN\nY\nN\nY\nT\n0\nT\nT\n3\nT\n4\nT\nS\n1\n1\nX\nY\n" | ./$executable
# test for deleting saves
echo -e "2\nsaves\nY\n3\n" | ./$executable
- name: Upload executable
uses: actions/upload-artifact@v4
Expand All @@ -136,19 +129,11 @@ jobs:
analyze:
needs: build-and-test
name: CodeQL Analysis (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
Expand All @@ -157,14 +142,6 @@ jobs:
include:
- language: c-cpp
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -174,28 +151,8 @@ jobs:
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Simple workflow for deploying static content to GitHub Pages
name: Pages (doxygen)

on:
[push, workflow_dispatch]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
# Allow only one concurrent deployment, skipping runs queued between the run in-progress
# and latest queued. However, do NOT cancel in-progress runs as we want to allow these
# production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
Expand Down
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Usage: -DOUTPUT_NAME=stocksim-cmake
# Check if the OUTPUT_NAME flag is provided
if(DEFINED OUTPUT_NAME)
# Set the output name to the provided value
set(OUTPUT_NAME ${OUTPUT_NAME})
else()
# Set the output name to "stocksim"
set(OUTPUT_NAME "stocksim")
endif()

Expand Down
34 changes: 10 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,18 @@ compile the program using the Microsoft Visual C++ compiler
# make check \
check the code for formatting and static analysis issues

# Edit C++ compiler name you want to use.
CXX = g++

INCLUDES = -Iinclude
OUTPUT = stocksim
CXXFLAGS += -Wall -Wextra -pedantic -std=c++17 -Werror -g \
-Wcast-qual -Wundef -mtune=generic -Wswitch -Wshadow -Wformat=2
-Wcast-qual -Wundef -Wswitch -Wshadow
# -Wconversion -Wfloat-equal
# -fsanitize=address -fsanitize=undefined

# macOS uses clang++, which does not support these flag:
# -Wduplicated-cond -Wduplicated-branches
ifeq ($(CXX),g++)
# do not change $(OS) to $(shell uname) because on Windows
# it might be MinGW or MSYS2, not Windows_NT
ifneq ($(shell uname),Darwin)
CXXFLAGS += -Wduplicated-cond -Wduplicated-branches
endif
endif

# eric15342335 will use the static flag on Windows.
# MinGW does not support -static-pie
ifeq ($(OS),Windows_NT)
# -pthread only needed for clang++ on Windows but anyway
# note: needed for MinGW clang++ to link pthread, but not for MSVC clang++?
# -pthread needed for clang++ on Windows
ifeq ($(CXX),clang++)
CXXFLAGS += -pthread
endif
Expand All @@ -59,12 +47,11 @@ CXXFLAGS += -z noexecstack -z relro -z now
endif
endif

# Shhh clang++
# Clang will warn about unused command line arguments.
ifeq ($(CXX),clang++)
CXXFLAGS += -Wno-error=unused-command-line-argument
endif

# The default target is to compile the program.
default: stocksim

random_price.o: src/random_price.cpp \
Expand Down Expand Up @@ -127,7 +114,7 @@ goto: stocksim
clean:
rm *.o stocksim* -r saves/ html/ latex/ *.obj *.pdb *.ilk *.dSYM/ 2>/dev/null || true

# Generate documentation using `Doxygen`.
# Used for github pages doxygen
docs: .github/Doxyfile src/*.cpp include/*.h
cp .github/Doxyfile Doxyfile.temp
echo PROJECT_NUMBER = $$(git branch --show-current) $$(git log -n1 --format="%h") >> Doxyfile.temp
Expand All @@ -140,18 +127,17 @@ fix:
git commit -a -m "Formatting: Run clang-format" -m "From Makefile: make fix"
git push

msvc: src/*.cpp include/*.h
# To compile the program using the Microsoft Visual C++ compiler,
# Launch the Visual Studio Developer Command Prompt
# and run the following command:
#
cl -std:c++17 -EHsc -utf-8 src/*.cpp -Iinclude -W1 -WX -Fe:stocksim-msvc.exe
msvc: src/*.cpp include/*.h clean
cl -std:c++17 -EHsc -utf-8 -Iinclude -W1 -WX -O1 -guard:cf -MP \
src/*.cpp -Fe:stocksim-msvc.exe
rm *.obj *.ilk || true

check:
clang-format --dry-run --Werror src/*.cpp include/*.h
clang-tidy src/*.cpp --checks=performance-*,-performance-avoid-endl,readability-*,bugprone-*,portability-*,cert-* \
--fix-errors --fix-notes --format-style=file -- -Iinclude

# cosmopolitan c++ compiler does not support -flto and stack protector
ifeq ($(MAKECMDGOALS),release)
ifneq ($(CXX),cosmoc++)
CXXFLAGS += -fstack-protector-strong
Expand Down

0 comments on commit 9ebc8e0

Please sign in to comment.