Conversation
Introduces a complete linting toolchain for all four languages: - .clang-format : Allman braces, 4-space, 140-char limit for C/C++ - .clang-tidy : bugprone/modernize/readability checks, naming conventions - pyproject.toml : ruff formatter + linter for Python (N801 relaxed for daoFoo convention) - rustfmt.toml : AlwaysNextLine (Allman), 140-char for Rust - .JuliaFormatter.toml : 4-space, 140-char for Julia - .pre-commit-config.yaml : hooks wiring all of the above to every commit - src/rust/.cargo/config.toml : rustflags -L path to libdao.so (required for cargo build)
Reformats all source files to match the conventions defined in the new linter config files. No logic changes — compiled output is identical. Languages reformatted: - C/C++ : Allman braces, include reordering, whitespace normalisation - Python : double quotes, isort import order, PEP 8 whitespace - Rust : rustfmt AlwaysNextLine style - Julia : 4-space indent, unix line endings - MATLAB : trailing whitespace and line endings only Also removes unused import (yaml) from daoComponent.py and fixes Rust Cargo.toml: bindgen moved to [build-dependencies], cc version corrected (11.4.0 → 1), invalid [build] key removed.
- docs/source/contributing.rst: new page covering per-language coding standards (C/C++, Python, Rust, Julia), individual linter commands, contribution workflow, and a table of all new config files - docs/source/index.rst: wire contributing page into toctree (Contributing section) and add card to the Documentation Guide HTML grid - .gitignore: ignore src/rust/target/ (build artefacts) and src/rust/Cargo.lock (library crate, lock not committed)
There was a problem hiding this comment.
Pull request overview
This PR introduces a repository-wide linting/formatting toolchain (via pre-commit) and applies the enforced style across C/C++, Python, Rust, Julia, MATLAB glue code, docs, and build scripts to standardize formatting and improve contribution workflow consistency.
Changes:
- Added pre-commit hooks and formatter/linter configuration for C/C++, Python (ruff), Rust (rustfmt/clippy), and Julia.
- Reformatted a broad set of source, test, and documentation files to match the enforced style rules.
- Added/updated documentation describing the contribution workflow and linting commands.
Reviewed changes
Copilot reviewed 63 out of 70 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| wscript | Python build script reformatted; options/build steps adjusted. |
| test/testCreate.c | Formatting/cleanup of includes and style. |
| test/test_update_thread.cpp | Formatting/import ordering updates in gtest. |
| test/test_threads.cpp | Formatting/style updates in gtest. |
| test/test_thread_block.cpp | Formatting/style updates in gtest. |
| test/test_shm.cpp | Formatting/style updates in gtest. |
| test/test_queue.cpp | Formatting/style updates in gtest. |
| test/test_proxyMirror.py | Ruff-style formatting. |
| test/test_proxyClientMirrorGUI.py | Ruff-style formatting/import spacing. |
| test/test_proxyClient.py | Ruff-style formatting/import spacing. |
| test/test_numa.cpp | Formatting/style updates in gtest. |
| test/test_log.cpp | Formatting/style updates in gtest. |
| test/test_dao_julia.jl | Julia formatting normalization. |
| test/test_cppInterface.cpp | Formatting/style updates in gtest; minor refactors. |
| test/test_component.cpp | Formatting/style updates in gtest. |
| test/daoTestComponent.cpp | Formatting/style updates; minor refactors. |
| test/daoShmBenchmark.c | Formatting/style updates in benchmark tool. |
| test/daoLogTest.c | Minor formatting cleanup. |
| test/daoBaseTestEvent.py | Ruff-style formatting and quoting updates. |
| src/rust/wrapper.h | Minor whitespace cleanup. |
| src/rust/Cargo.toml | Rust build dependency/layout adjustments for bindings. |
| src/rust/.cargo/config.toml | Adds rustflags link path configuration for Rust bindings. |
| src/python/daoProxy.py | Ruff-style formatting; capture loop updated. |
| src/python/daoLog.py | Ruff-style formatting; minor whitespace/quoting updates. |
| src/python/daoEvent.py | Ruff-style formatting; quoting updates. |
| src/python/daoDb.py | Ruff-style formatting; minor refactors/renames. |
| src/python/daoComponentStateMachine.py | Ruff-style formatting; quoting updates. |
| src/python/daoComponent.py | Ruff-style formatting; command/state handling code touched. |
| src/python/dao.py | Docstring quoting and import reordering. |
| src/matlab/README | Whitespace normalization. |
| src/matlab/daoShm.m | Whitespace/indentation normalization. |
| src/matlab/daomex.c | Formatting and minor signature styling. |
| src/julia/README | Whitespace normalization. |
| src/cpp/daoNuma.cpp | C++ formatting updates. |
| rustfmt.toml | Adds repo-level rustfmt configuration. |
| README.md | Adds a code-style/linting section and contributor guidance link. |
| pyproject.toml | Adds ruff formatter/linter configuration. |
| include/daoThreadTable.hpp | C++ formatting updates. |
| include/daoThreadSafeQueue.hpp | C++ formatting updates; method bodies touched. |
| include/daoThreadIfce.hpp | C++ formatting updates. |
| include/daoThreadBase.hpp | C++ formatting updates; structure/layout touched. |
| include/daoThread.hpp | C++ formatting updates. |
| include/daoSignalTable.hpp | C++ formatting updates. |
| include/daoShm.hpp | C++ formatting updates and include ordering. |
| include/daoNuma.hpp | C++ formatting updates. |
| include/daoDoubleBuffer.hpp | C++ formatting updates and layout normalization. |
| include/daoComponentUpdateThread.hpp | C++ formatting updates and layout normalization. |
| include/daoComponentStateMachine.hpp | C++ formatting updates and layout normalization. |
| include/daoComponentIfce.hpp | C++ formatting updates. |
| include/daoComponentBase.hpp | C++ formatting updates. |
| include/daoComponent.hpp | C++ formatting updates. |
| include/daoBase.h | Formatting updates in legacy C header/macros. |
| docs/source/index.rst | Adds Contributing section link in docs index. |
| docs/source/contributing.rst | New contribution/style guide documentation page. |
| docs/source/conf.py | Formatting/quoting updates. |
| build_tools/pkg_tool.py | Formatting and minor refactor for pkgconfig generation. |
| .pre-commit-config.yaml | Adds pre-commit hooks for formatting/linting toolchain. |
| .JuliaFormatter.toml | Adds JuliaFormatter configuration. |
| .gitignore | Ignores Rust build artifacts and Cargo.lock for library crate. |
| .clang-tidy | Adds clang-tidy configuration. |
| .clang-format | Adds clang-format style configuration. |
Comments suppressed due to low confidence (1)
src/python/daoComponent.py:17
- The base state machine is initialized via
super(daoComponentStateMachine, self).__init__(self, name), which is not the normalsuper()usage and passes an extraselfargument. SincedaoComponentStateMachine.__init__expects just(self, name), this should besuper().__init__(name)to avoidTypeErrorand ensure the state machine is correctly constructed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+36
to
+40
| ThreadSafeQueue(ThreadSafeQueue<T>&& other) | ||
| { | ||
| std::lock_guard<std::mutex> lock(m_mutex); | ||
| m_queue = std::move(other.m_queue); | ||
| } |
Comment on lines
+67
to
+70
| inline bool empty() const | ||
| { | ||
| return m_queue.empty(); | ||
| } |
Comment on lines
31
to
+33
| self.capSub_socket = self.context.socket(zmq.SUB) | ||
| self.capSub_socket.connect(f"tcp://*:{capPort}") | ||
| self.capSub_socket.subscribe('') | ||
| self.capSub_socket.subscribe("") |
Comment on lines
+37
to
39
| print(f"Starting a proxy server port {self.xsubPort} to {self.xpubPort}") | ||
| # Create a proxy to forward messages between the XPUB and XSUB sockets | ||
| zmq.proxy(self.xsub_socket, self.xpub_socket) |
Comment on lines
106
to
+112
| def user_dump(): | ||
| pass | ||
|
|
||
| # must return | ||
| # must return | ||
| # True/False for success and | ||
| # string | ||
|
|
Comment on lines
+53
to
+57
| char* daoBaseGetTimeStamp(); | ||
| #define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) | ||
|
|
||
| int daoLogLevel = 1; | ||
| #define daoError(fmt, ...) fprintf(stderr, ANSI_COLOR_RESET ANSI_COLOR_BLUE "%s " ANSI_COLOR_RESET ANSI_COLOR_RED "[error]" ANSI_COLOR_RESET " %s:%d: " fmt, daoBaseGetTimeStamp(), __FUNCTION__, __LINE__, ##__VA_ARGS__) | ||
| #define daoPrint(fmt, ...) \ | ||
| do { fprintf(stdout, "%s:%d: " fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__); } while(0) | ||
| #define daoWarning(fmt, ...) \ | ||
| do { if (daoLogLevel>=DAO_WARNING) fprintf(stdout, ANSI_COLOR_RESET ANSI_COLOR_BLUE "%s " ANSI_COLOR_RESET ANSI_COLOR_ORANGE "[warning]" ANSI_COLOR_RESET " %s:%s:%d: " fmt, daoBaseGetTimeStamp(), __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__); } while(0) | ||
| #define daoInfo(fmt, ...) \ | ||
| do { if (daoLogLevel>=DAO_INFO) fprintf(stdout, ANSI_COLOR_RESET ANSI_COLOR_BLUE "%s " ANSI_COLOR_RESET ANSI_COLOR_GREEN "[info]" ANSI_COLOR_RESET " %s:%s:%d: " fmt, daoBaseGetTimeStamp(), __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__); } while(0) | ||
| #define daoDebug(fmt, ...) \ | ||
| do { if (daoLogLevel>=DAO_DEBUG) fprintf(stdout, ANSI_COLOR_RESET ANSI_COLOR_BLUE "%s " ANSI_COLOR_RESET ANSI_COLOR_YELLOW "[debug]" ANSI_COLOR_RESET " %s:%s:%d: " fmt, daoBaseGetTimeStamp(), __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__); } while(0) | ||
| #define daoTrace(fmt, ...) \ | ||
| do { if (daoLogLevel>=DAO_TRACE) fprintf(stdout, ANSI_COLOR_RESET ANSI_COLOR_BLUE "%s " ANSI_COLOR_RESET "[trace] %s:%s:%d " fmt, daoBaseGetTimeStamp(), __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0) | ||
| #define daoError(fmt, ...) \ |
fixing typo Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
fixing typo Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
fixing indentation and comments Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First implementation of linting and forced style guide.