Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b1ef740
Add clang-tidy and clang-tidy-fix targets
andreiltd Apr 25, 2025
dd5ff1d
Merge branch 'main' into clang-tidy
andreiltd Jul 15, 2025
bb3fa2e
Merge branch 'main' into clang-tidy
andreiltd Aug 18, 2025
601b01c
Make linter target depend on starling-raw.wasm
andreiltd Jul 18, 2025
a49cfeb
fix: clang-analyzer errors
andreiltd Aug 18, 2025
518911b
fix: clang-analyzer errors in script loader
andreiltd Aug 18, 2025
5ab268c
fix: enable cppcoreguidelines checks and apply auto fixes
andreiltd Aug 18, 2025
7084086
fix: enable modernize lints and apply auto fixes
andreiltd Aug 18, 2025
567cd73
fix: use js_new for RefCounted types
andreiltd Aug 18, 2025
9f6b97d
fix: fix performance lint about unnecesairly large enum base
andreiltd Aug 18, 2025
37fddbc
fix: enable performace checks and appy autofixes
andreiltd Aug 18, 2025
4bfbb7d
fix: apply linter readability fixes
andreiltd Aug 18, 2025
98c9281
fix: do not use const members
andreiltd Aug 18, 2025
c589688
fix: remove unused declarations
andreiltd Aug 18, 2025
65f3344
ci: add CI step for linter
andreiltd Aug 18, 2025
2d9f230
Merge branch 'main' into clang-tidy
andreiltd Aug 18, 2025
8d0ca13
fix: apply fixes after merging main
andreiltd Aug 18, 2025
cbd70da
fix: enable no-malloc checks and apply fixes
andreiltd Aug 19, 2025
457b6c2
fix: allow implicit pointer to bool conversions
andreiltd Aug 19, 2025
3a572f6
Apply suggestions from code review
andreiltd Aug 19, 2025
7bf4316
fix: remove clang pragmas
andreiltd Aug 19, 2025
3860451
fix: bounds constant array index
andreiltd Aug 19, 2025
f9b099a
fix: enable special member functions lint
andreiltd Aug 19, 2025
aa664cb
fix: enable type const cast check
andreiltd Aug 19, 2025
c246ba4
fix: enable bugprone checks
andreiltd Aug 20, 2025
30f2b5d
fix: correct indentation
andreiltd Aug 20, 2025
1e9e30a
Apply suggestions from code review
andreiltd Aug 21, 2025
98ba4d1
fix: align declaration arguments with impl
andreiltd Aug 21, 2025
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
21 changes: 21 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Checks: >
clang-diagnostic-*,
clang-analyzer-*,
cppcoreguidelines-*,
modernize-*,
performance-*,
readability-*,
-modernize-use-trailing-return-type,
-readability-identifier-length

# Treat all warnings as errors
WarningsAsErrors: '*'

# Only warn on headers in the code tree
HeaderFilterRegex: 'builtins/|runtime/'

# Use the same style as clang-format (look for .clang-format)
FormatStyle: file

# Don’t analyze temporary dtors (speeds up checking)
AnalyzeTemporaryDtors: false
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ include("spidermonkey")
include("openssl")
include("${HOST_API}/host_api.cmake")
include("build-crates")
include("lint")

option(ENABLE_JS_DEBUGGER "Enable support for debugging content via a socket connection" ON)

Expand Down
28 changes: 28 additions & 0 deletions cmake/lint.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set(CLANG_TIDY ${WASI_SDK_PREFIX}/bin/clang-tidy)
set(RUN_CLANG_TIDY ${WASI_SDK_PREFIX}/bin/run-clang-tidy)
set(CLANG_APPLY_REPLACEMENTS ${WASI_SDK_PREFIX}/bin/clang-apply-replacements)
set(WASI_SYSROOT ${WASI_SDK_PREFIX}/share/wasi-sysroot)

add_custom_target(clang-tidy
COMMAND ${RUN_CLANG_TIDY}
-p=${CMAKE_BINARY_DIR}
-clang-tidy-binary=${CLANG_TIDY}
-extra-arg=--sysroot=${WASI_SYSROOT}
-config-file=${CMAKE_SOURCE_DIR}/.clang-tidy
${CMAKE_SOURCE_DIR}/builtins
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running clang‑tidy over the codebase"
VERBATIM)

add_custom_target(clang-tidy-fix
COMMAND ${RUN_CLANG_TIDY}
-p=${CMAKE_BINARY_DIR}
-clang-tidy-binary=${CLANG_TIDY}
-clang-apply-replacements-binary=${CLANG_APPLY_REPLACEMENTS}
-extra-arg=--sysroot=${WASI_SYSROOT}
-config-file=${CMAKE_SOURCE_DIR}/.clang-tidy
-fix
${CMAKE_SOURCE_DIR}/builtins
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running clang‑tidy over the codebase and applying fixes"
VERBATIM)
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ do_clean:
clean-all: && do_clean
@echo "This will remove {{builddir}}"

# Run clang-tidy
lint: (build "clang-tidy")

# Run clang-tidy and apply offered fixes
lint-fix: (build "clang-tidy-fix")

# Componentize js script
componentize script="" outfile="starling.wasm": build
{{ builddir }}/componentize.sh {{ script }} -o {{ outfile }}
Expand Down