Skip to content

Commit

Permalink
[Misc] clean up typos and enable general linter (WasmEdge#2165)
Browse files Browse the repository at this point in the history
* [Chore] clean up typos and enable general linter

Signed-off-by: RRobot-lm <[email protected]>
  • Loading branch information
RRobot-lm authored Dec 27, 2022
1 parent 602029e commit 407386c
Show file tree
Hide file tree
Showing 118 changed files with 290 additions and 254 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ignore_words
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ans
archtype
copyable
crate
datas
expext
inflight
keypair
nd
od
olt
ressize
seh
ser
te
unexpect
19 changes: 19 additions & 0 deletions .github/workflows/misc-linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Misc linters

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
misc:
name: misc linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: check spell
run: |
pip install codespell
# exclude files which may be synchronized from other places
git ls-files | grep -v "^thirdparty" | grep -v '^docs/witx' |xargs -t codespell --ignore-words .github/workflows/ignore_words 2>/dev/null
28 changes: 14 additions & 14 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Fixed issues:
* Fixed the repeatedly compilation of universal WASM format.
* If users use the `wasmedgec` tool to compile the universal WASM file, the AOT compiled WASM data will be appended into the output.
* In the cases of duplicated AOT compiled universal WASM file which has more than 1 section of AOT compiled WASM data, the WasmEdge runtime will use the latest appended one when execution.
* Hided the local symbols of the WasmEdge shared library.
* Hidden the local symbols of the WasmEdge shared library.
* Loaded the default plug-in path from the path related to the WasmEdge shared library.
* This only fixed on the MacOS and Linux platforms now.
* Updated the minimum CMake required version on Android.
Expand Down Expand Up @@ -179,16 +179,16 @@ Breaking changes:
* The first parameter of `WasmEdge_WrapFunc_t` is replaced by `const WasmEdge_CallingFrameContext *`.
* Extended the content of `WasmEdge_Result`.
* Added the const qualifier of some APIs.
* Added the const qualifer of the first parameter of `WasmEdge_StoreFindModule()`.
* Added the const qualifer of the first parameter of `WasmEdge_AsyncWait()`.
* Added the const qualifer of the first parameter of `WasmEdge_AsyncWaitFor()`.
* Added the const qualifer of the first parameter of `WasmEdge_AsyncGetReturnsLength()`.
* Added the const qualifer of the first parameter of `WasmEdge_AsyncGet()`.
* Added the const qualifer of the first parameter of `WasmEdge_VMGetFunctionType()`.
* Added the const qualifer of the first parameter of `WasmEdge_VMGetFunctionTypeRegistered()`.
* Added the const qualifer of the first parameter of `WasmEdge_VMGetFunctionListLength()`.
* Added the const qualifer of the first parameter of `WasmEdge_VMGetFunctionList()`.
* Added the const qualifer of the first parameter of `WasmEdge_VMGetImportModuleContext()`.
* Added the const qualifier of the first parameter of `WasmEdge_StoreFindModule()`.
* Added the const qualifier of the first parameter of `WasmEdge_AsyncWait()`.
* Added the const qualifier of the first parameter of `WasmEdge_AsyncWaitFor()`.
* Added the const qualifier of the first parameter of `WasmEdge_AsyncGetReturnsLength()`.
* Added the const qualifier of the first parameter of `WasmEdge_AsyncGet()`.
* Added the const qualifier of the first parameter of `WasmEdge_VMGetFunctionType()`.
* Added the const qualifier of the first parameter of `WasmEdge_VMGetFunctionTypeRegistered()`.
* Added the const qualifier of the first parameter of `WasmEdge_VMGetFunctionListLength()`.
* Added the const qualifier of the first parameter of `WasmEdge_VMGetFunctionList()`.
* Added the const qualifier of the first parameter of `WasmEdge_VMGetImportModuleContext()`.
* Renamed the plugin API.
* Renamed `WasmEdge_Plugin_loadWithDefaultPluginPaths()` to `WasmEdge_PluginLoadWithDefaultPaths()`.
* Dropped the manylinux1 and manylinux2010 support. Please refer to the [deprecation notice](https://github.com/WasmEdge/WasmEdge/discussions/1780).
Expand All @@ -212,7 +212,7 @@ Features:
* New `WasmEdge_CallingFrameContext` struct.
* Developers can use `WasmEdge_CallingFrameGetModuleInstance()` API to get the module instance of current top frame in calling stack in host function body.
* Developers can use `WasmEdge_CallingFrameGetMemoryInstance()` API to get the memory instance by index in host function body.
* To quickly upgrate from the previous WasmEdge versions, developer can use the `WasmEdge_CallingFrameGetMemoryInstance(Context, 0)` to get the same memory instance of the previous host function definition.
* To quickly upgrade from the previous WasmEdge versions, developer can use the `WasmEdge_CallingFrameGetMemoryInstance(Context, 0)` to get the same memory instance of the previous host function definition.
* Developers can use `WasmEdge_CallingFrameGetExecutor()` API to get the executor context in host function body.
* Extended the `WasmEdge_Result` struct to support user defined error codes of host functions.
* Added `WasmEdge_ResultGen()` API to generate the `WasmEdge_Result` struct of user defined error code.
Expand Down Expand Up @@ -243,7 +243,7 @@ Fixed issues:

Refactor:

* Reorginized the CI workflows to reuse the similar jobs.
* Reorganized the CI workflows to reuse the similar jobs.
* Refactored the enum related headers.
* Separated the C and C++ enum definition headers.
* Not to package the C++ related headers.
Expand Down Expand Up @@ -556,7 +556,7 @@ Breaking changes:
* To enable instruction counting, please use `--enable-instruction-count`.
* To enable gas measuring, please use `--enable-gas-measuring`.
* To enable time measuring, please use `--enable-time-measuring`.
* For the convinence, use `--enable-all-statistics` will enable all available statistics options.
* For the convenience, use `--enable-all-statistics` will enable all available statistics options.
* `wasmedgec` AOT compiler tool behavior changes.
* For the output file name with extension `.so`, `wasmedgec` will output the AOT compiled WASM in shared library format.
* For the output file name with extension `.wasm` or other cases, `wasmedgec` will output the WASM file with adding the AOT compiled binary in custom sections. `wasmedge` runtime will run in AOT mode when it executes the output WASM file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
COMPACT_CTOR_DEF"/>
</module>
<module name="SuppressionXpathSingleFilter">
<!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
<!-- suppression is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
<property name="id" value="RightCurlyAlone"/>
<property name="query" value="//RCURLY[parent::SLIST[count(./*)=1]
or preceding-sibling::*[last()][self::LCURLY]]"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.wasmedge.enums;

/**
* Compiler optimization leve enums.
* Compiler optimization level enums.
*/
public enum CompilerOptimizationLevel {
/// Disable as many optimizations as possible.
Expand Down
4 changes: 2 additions & 2 deletions bindings/java/wasmedge-java/wasmedge-jni/lib/WasmEdgeVM.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Java_org_wasmedge_WasmEdgeVm_instantiate(JNIEnv *env, jobject thisObject) {

JNIEXPORT void JNICALL Java_org_wasmedge_WasmEdgeVm_execute(
JNIEnv *env, jobject thisObject, jstring funcName, jobjectArray params,
jint paramSize, jintArray paramTypes, jobjectArray retuns, jint returnSize,
jint paramSize, jintArray paramTypes, jobjectArray returns, jint returnSize,
jintArray returnTypes) {

WasmEdge_VMContext *VMCxt = getVmContext(env, thisObject);
Expand Down Expand Up @@ -230,7 +230,7 @@ JNIEXPORT void JNICALL Java_org_wasmedge_WasmEdgeVm_execute(
if (WasmEdge_ResultOK(Res)) {
for (int i = 0; i < returnSize; ++i) {
setJavaValueObject(env, Returns[i],
(*env)->GetObjectArrayElement(env, retuns, i));
(*env)->GetObjectArrayElement(env, returns, i));
}
}

Expand Down
2 changes: 1 addition & 1 deletion bindings/java/wasmedge-java/wasmedge-jni/lib/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void ReleaseCString(JNIEnv *env, jarray jStrArray, const char **ptr) {

for (int i = 0; i < len; i++) {
jstring jStr = (*env)->GetObjectArrayElement(env, jStrArray, i);
// TODO fixeme
// TODO fixme
//(*env)->ReleaseStringUTFChars(env, jStr, ptr[i]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ fn sys_expand_host_func(item_fn: &syn::ItemFn) -> syn::Result<proc_macro2::Token
let wrapper_fn_name_literal = wrapper_fn_name_ident.to_string();
// return type of wrapper function
let wrapper_fn_return = item_fn.sig.output.clone();
// visiblity of wrapper function
// visibility of wrapper function
let wrapper_fn_visibility = item_fn.vis.clone();

// * define the signature of inner function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_dir = std::env::current_dir()?;
let aot_filename = "example_aot_fibonacci";

// compile wasm to so for runing in the `aot` mode
// compile wasm to so for running in the `aot` mode
let compiler = Compiler::new(Some(&config))?;
let aot_file_path = compiler.compile_from_file(wasm_file, aot_filename, out_dir)?;
assert!(&aot_file_path.exists());
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sdk/src/externals/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ mod tests {
assert!(result.is_ok());
assert_eq!(memory.size(), 15);

// get memory from instance agains
// get memory from instance again
let result = instance.memory("memory");
assert!(result.is_some());
let memory = result.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sdk/src/externals/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Table {
self.inner.capacity() as u32
}

/// Grows the size of this table by `delta`, initializating the elements with the provided init value if `init` is given.
/// Grows the size of this table by `delta`, initializing the elements with the provided init value if `init` is given.
///
/// # Arguments
///
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sdk/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ mod tests {
assert!(result.is_ok());
assert_eq!(memory.size(), 15);

// get memory from instance agains
// get memory from instance again
let result = instance.memory("memory");
assert!(result.is_some());
let memory = result.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions bindings/rust/wasmedge-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ pub trait Engine {
///
/// * `params` - The arguments to pass to the function.
///
/// # Erros
/// # Errors
///
/// If fail to run the host function, then an error is returned.
fn run_func(
Expand All @@ -245,7 +245,7 @@ pub trait Engine {
///
/// * `params` - The arguments to pass to the function.
///
/// # Erros
/// # Errors
///
/// If fail to run the host function, then an error is returned.
fn run_func_ref(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! This example demonstrates that the function in interpreter mode calls the functions in AOT mode, and vise versa.
//! This example demonstrates that the function in interpreter mode calls the functions in AOT mode, and vice versa.
use wasmedge_macro::sys_host_function;
#[cfg(feature = "aot")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ fn vm_apis() -> Result<(), Box<dyn std::error::Error>> {
"#,
)?;

// load a wasm module from a in-memory bytes, and the loaded wasm module works as an anoymous
// load a wasm module from a in-memory bytes, and the loaded wasm module works as an anonymous
// module (aka. active module in WasmEdge terminology)
vm.load_wasm_from_bytes(&wasm_bytes)?;

// validate the loaded active module
vm.validate()?;

// instatiate the loaded active module
// instantiate the loaded active module
vm.instantiate()?;

// get the active module instance
Expand Down
4 changes: 2 additions & 2 deletions bindings/rust/wasmedge-sys/examples/vm_get_active_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// create a VM context
let vm = Vm::create(None, None)?;

// load a wasm module from a in-memory bytes, and the loaded wasm module works as an anoymous
// load a wasm module from a in-memory bytes, and the loaded wasm module works as an anonymous
// module (aka. active module in WasmEdge terminology)
vm.load_wasm_from_bytes(&wasm_bytes)?;

// validate the loaded active module
vm.validate()?;

// instatiate the loaded active module
// instantiate the loaded active module
vm.instantiate()?;

// get the active module instance
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sys/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ mod tests {
assert!(config.is_time_measuring());
assert!(config.interpreter_mode_enabled());

// set maxmimum memory pages
// set maximum memory pages
config.set_max_memory_pages(10);
assert_eq!(config.get_max_memory_pages(), 10);
#[cfg(feature = "aot")]
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sys/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl CallingFrame {
///
/// If the executing function instance is a host function and not added into any module instance, then returns `None`.
///
/// When a wasm function is executing and tring to call a host function inside, a frame with the module
/// When a wasm function is executing and trying to call a host function inside, a frame with the module
/// instance the wasm function belongs to will be pushed onto the stack. And therefore the calling frame
/// context will record that module instance.
///
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sys/src/instance/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ impl FuncType {
///
/// # Arguments
///
/// * `args` - The agrgument types of a [Function].
/// * `args` - The argument types of a [Function].
///
/// * `returns` - The types of the returns of a [Function].
///
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sys/src/instance/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3369,7 +3369,7 @@ mod tests {
assert!(!store.inner.0.is_null());
assert!(!store.registered);

// check the length of registered module list in store before instatiation
// check the length of registered module list in store before instantiation
assert_eq!(store.module_len(), 0);
assert!(store.module_names().is_none());

Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sys/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn match_value(s: &str) -> WasmValue {
"f32" => WasmValue::from_f32(0.),
"f64" => WasmValue::from_f64(0.),
"u128" => WasmValue::from_v128(0),
_ => panic!("unsupport type for WasmFnIO"),
_ => panic!("unsupported type for WasmFnIO"),
}
}
pub trait WasmFnIO {
Expand Down
4 changes: 2 additions & 2 deletions bindings/rust/wasmedge-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ pub trait Engine {
///
/// * `params` - The arguments to pass to the function.
///
/// # Erros
/// # Errors
///
/// If fail to run the host function, then an error is returned.
fn run_func(
Expand All @@ -277,7 +277,7 @@ pub trait Engine {
///
/// * `params` - The arguments to pass to the function.
///
/// # Erros
/// # Errors
///
/// If fail to run the host function, then an error is returned.
fn run_func_ref(
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sys/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Loader {
impl Loader {
/// Create a new [Loader](crate::Loader) to be associated with the given global configuration.
///
/// # Arguements
/// # Arguments
///
/// * `config` - A global configuration.
///
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/wasmedge-sys/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ mod tests {
assert!(!store.inner.0.is_null());
assert!(!store.registered);

// check the length of registered module list in store before instatiation
// check the length of registered module list in store before instantiation
assert_eq!(store.module_len(), 0);
assert!(store.module_names().is_none());

Expand Down
Loading

0 comments on commit 407386c

Please sign in to comment.