Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode paths, Static analysis, Update Libs, Fix typos #191

Merged
merged 19 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# game abbreviations
som
# variable names
ot
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = ./.git,./packs,./nbproject,./lib,./build,./win32-lib,./win32-lib-src,./scan-build-reports,node_modules,./examples/template_pack/scripts/custom_items/class.lua,*.pem
ignore-words = ./.codespellignore
17 changes: 17 additions & 0 deletions .github/workflows/codespell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Codespell

on:
push:
pull_request:

jobs:
codespell:
runs-on: ubuntu-latest
name: Find typos

steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
check_hidden: true
56 changes: 56 additions & 0 deletions .github/workflows/scan-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Native Code Static Analysis

on:
push:
paths:
- '**.c'
- '**.cc'
- '**.cpp'
- '**.cxx'
- '**.h'
- '**.hh'
- '**.hpp'
- '.github/workflows/scan-build.yml'
pull_request:
paths:
- '**.c'
- '**.cc'
- '**.cpp'
- '**.cxx'
- '**.h'
- '**.hh'
- '**.hpp'
- '.github/workflows/scan-build.yml'

jobs:
scan-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies (apt)
run: |
sudo apt-get update -y -qq
sudo apt-get install coreutils build-essential libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libgtest-dev
- name: Install newer Clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 18
- name: Install scan-build command
run: |
sudo apt install clang-tools-18
- name: scan-build
run: |
scan-build-18 --status-bugs -o scan-build-reports \
--exclude build --exclude lib/lua \
--exclude lib/miniz \
make -j3
- name: Store report
if: failure()
uses: actions/upload-artifact@v4
with:
name: scan-build-reports
path: scan-build-reports
27 changes: 24 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ jobs:
matrix:
os: [ubuntu-latest, macos-13, macos-latest]
shell: [bash]
extra_make_args: [''] # default build
include:
- os: windows-latest
shell: msys2 {0}
extra_make_args: ''
- os: macos-13
shell: bash
# we now require 10.15 by default, but 10.13 should work with an extra dependency
extra_make_args: 'MACOS_DEPLOYMENT_TARGET=10.13'

name: Test ${{ matrix.os }}
name: Test ${{ matrix.os }} ${{ matrix.extra_make_args }}
runs-on: ${{ matrix.os }}

defaults:
Expand All @@ -52,6 +58,10 @@ jobs:
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
brew install coreutils SDL2 sdl2_ttf sdl2_image [email protected] googletest || true
- name: Install extra dependencies (brew)
if: ${{ startsWith(matrix.os, 'macos') && contains(matrix.extra_make_args, 'MACOS_DEPLOYMENT_TARGET') }}
run: |
brew install boost || true
- name: Install dependencies (msys2)
if: ${{ startsWith(matrix.os, 'windows') }}
uses: msys2/setup-msys2@v2
Expand Down Expand Up @@ -79,7 +89,18 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure ASAN (macos-latest)
if: ${{ startsWith(matrix.os, 'macos-latest') }}
run: |
# see https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow#false-positives
# since we don't build gtest with ASAN, we hit this issue on macos-latest
echo "ASAN_OPTIONS=detect_container_overflow=0" >> $GITHUB_ENV
- name: Enable ASAN
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
# we use mingw on windows, which does not support ASAN
echo "extra_make_args=WITH_ASAN=true ${{ matrix.extra_make_args }}" >> $GITHUB_ENV
- name: Build DEBUG
run: make native CONF=DEBUG -j4
run: make native CONF=DEBUG ${{ env.extra_make_args }} -j4
- name: Run tests
run: make test CONF=DEBUG
run: make test CONF=DEBUG ${{ env.extra_make_args }} -j4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ screenshots
packlist
pop-pack-create-versions

# exclude tool chain dependant files
# exclude tool chain dependent files
win32-lib
win32-lib-src
2 changes: 1 addition & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Dependencies to build the bundle: install git and `brew install automake libtool
The release builds for Windows and macOS are very custom since we do not want to force msys or brew on anyone and use a
gnu toolchain for development.

* Meson's submodules system would be great, but some of them are very outdated or incomplete and maintinaing the recipes
* Meson's submodules system would be great, but some of them are very outdated or incomplete and maintaining the recipes
for all dependencies is too much work.
* CMake did fail when trying to create the static windows build, at which point we'd need to modify and maintain CMake
files for subprojects.
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* Lua: Added LocationSection.FullID to get the full location/section string
* Added flag "apmanual" to enable sending in Archipelago
* Fixes
* Fix map tooltip placement being wrong under certain cirumstances
* Fix map tooltip placement being wrong under certain circumstances
* Fix sections with sequence break + inspect not showing up correctly
* Fix a race condition in snes autotracking
* Ignore "allow_disabled" for items where behavior wasn't documented: toggle, static, toggle_badged
Expand Down
31 changes: 26 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
- check [doc/OUTLINE.md](doc/OUTLINE.md) to get an idea how this is supposed to work,
- check [doc/TODO.md](doc/TODO.md) and `//TODO:` comments to see what has to be done.

Send PRs on github.
Send PRs on GitHub.

## C++ Style

- cpp and h filenames are all lowercase, named after the class name
- 120 chars per line
- new code should mostly follow [WebKit C++ style](https://webkit.org/code-style-guidelines/),
with exception of
except for
- `m_` for member variables is not required: just `_` is fine (read below)
- `s_` for static members is not required
- getters start with `get` - it would take a major refactor to change them all
- include guards are `_FOLDER_FOLDER_FILENAME_H`,
closing `#endif` should have the name as comment
- `#pragma once` is preferred for new code
- `#pragma once` is preferred over include guards for new code
- camelCase
- protected and private member variables start with `_`
- local variables start with a lower case letter
Expand All @@ -25,8 +25,8 @@ Send PRs on github.
- public member variables should start with a lower case letter - this is to match SDL's structs
- public member variables should only be used for simple structs - use getters/setters otherwise
- getters start with `get`, setters with `set`
- class names start with a captial letter
- one exception to the above is the Lua Inferface, which uses `T::Lua_CamelCase`
- class names start with a capital letter
- one exception to the above is the Lua Interface, which uses `T::Lua_CamelCase`
- loops/iterations use `auto :` or `auto& :` where possible
- use `std::string` or `std::string_view` (we target c++17)
- there are a ton of violations, but new code should still try to check all the boxes
Expand All @@ -39,6 +39,11 @@ Send PRs on github.
- unique_ptr are fine, "raw pointers" are also fine, but should probably refactor uilib at some point
- avoid shared and weak since they are far from free; prefer clear ownership and life cycle

### Dependencies' Styles

If a dependency can be used as-is, its style should not be changed from upstream.
Use `diff -E -b --color=always -u ...` to compare upstream versions if style is inconsistent.

### "Mandatory" Optimizations

- we want to be able to deploy to wasm
Expand All @@ -55,6 +60,22 @@ Send PRs on github.
- use private (not protected) where possible to avoid going through vtables
- implement small functions inline in header files for platforms where LTO does not work correctly

### Static Analysis

We run [scan-build](https://clang.llvm.org/docs/analyzer/user-docs/CommandLineUsage.html#scan-build)
in CI to catch some mistakes, excluding some libs.

See [scan-build.yaml](../.github/workflows/scan-build.yaml).

### Address Sanitizer

Consider testing with ASAN by passing WITH_ASAN=true to make.

### Spell Checker

We use codespell to find typos. You can `pip install codespell` or rely on the GitHub workflow.
See `.codespellrc` if you want to exclude files/folders and `.codespellignore` if you want to exclude a word.

## Documentation Style

Markdown per [Google Markdown style guide](https://google.github.io/styleguide/docguide/style.html)
Expand Down
6 changes: 3 additions & 3 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Credits

## Code Contibutors
## Code Contributors

* [black-sliver](https://github.com/black-sliver)
* [sbzappa](https://github.com/sbzappa)
* [coavins](https://github.com/coavins/)

## Other Contributors

* [Cyb3R](https://github.com/Cyb3RGER) - the new icon + figuring out, testing and brainstorming all teh stuff, also schema.
* [Cyb3R](https://github.com/Cyb3RGER) - the new icon + figuring out, testing and brainstorming all the stuff, also schema.
* [jsd1982](https://github.com/JamesDunne) & [total](https://github.com/tewtal) - providing snes/sni/usb2snes infos
* [MisterIbis]( https://github.com/MisterIbis) - doing some documenation
* [MisterIbis]( https://github.com/MisterIbis) - doing some documentation

## Libraries

Expand Down
Loading
Loading