chore: error on bad c++ formatting in ci (#1499)

This commit is contained in:
Ryan Dahl 2024-06-11 11:10:17 -04:00 committed by GitHub
parent def3fd06ec
commit c3687bd565
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 13 deletions

View File

@ -195,6 +195,15 @@ jobs:
uses: dtolnay/rust-toolchain@nightly uses: dtolnay/rust-toolchain@nightly
if: matrix.config.variant == 'asan' if: matrix.config.variant == 'asan'
- name: check rust code formatting
run: cargo fmt --check
- name: check c++ code formatting
if: startsWith(matrix.config.os, 'ubuntu')
run: |
sudo apt-get install -y clang-format
clang-format --Werror --dry-run src/binding.cc
- name: Test (ASAN) - name: Test (ASAN)
env: env:
SCCACHE_IDLE_TIMEOUT: 0 SCCACHE_IDLE_TIMEOUT: 0
@ -220,9 +229,6 @@ jobs:
${{ matrix.config.cargo }} clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} ${{ matrix.config.cargo }} clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
--target ${{ matrix.config.target }} -- -D clippy::all --target ${{ matrix.config.target }} -- -D clippy::all
- name: Rustfmt
run: cargo fmt -- --check
- name: Prepare binary publish - name: Prepare binary publish
if: matrix.config.variant == 'debug' || matrix.config.variant == 'release' if: matrix.config.variant == 'debug' || matrix.config.variant == 'release'
run: gzip -9c run: gzip -9c

View File

@ -1200,12 +1200,12 @@ void v8__Template__Set(const v8::Template& self, const v8::Name& key,
ptr_to_local(&self)->Set(ptr_to_local(&key), ptr_to_local(&value), attr); ptr_to_local(&self)->Set(ptr_to_local(&key), ptr_to_local(&value), attr);
} }
void v8__Template__SetIntrinsicDataProperty( void v8__Template__SetIntrinsicDataProperty(const v8::Template& self,
const v8::Template& self, const v8::Name& key, const v8::Name& key,
v8::Intrinsic intrinsic, v8::Intrinsic intrinsic,
v8::PropertyAttribute attr) { v8::PropertyAttribute attr) {
ptr_to_local(&self)->SetIntrinsicDataProperty(ptr_to_local(&key), ptr_to_local(&self)->SetIntrinsicDataProperty(ptr_to_local(&key), intrinsic,
intrinsic, attr); attr);
} }
const v8::ObjectTemplate* v8__ObjectTemplate__New( const v8::ObjectTemplate* v8__ObjectTemplate__New(
@ -1810,10 +1810,8 @@ size_t v8__ArrayBuffer__ByteLength(const v8::ArrayBuffer& self) {
return self.ByteLength(); return self.ByteLength();
} }
const v8::DataView* v8__DataView__New( const v8::DataView* v8__DataView__New(const v8::ArrayBuffer& ab, size_t offset,
const v8::ArrayBuffer& ab, size_t length) {
size_t offset,
size_t length) {
return local_to_ptr(v8::DataView::New(ptr_to_local(&ab), offset, length)); return local_to_ptr(v8::DataView::New(ptr_to_local(&ab), offset, length));
} }