Skip to content

Commit c6d0b8b

Browse files
author
AstroAir
committed
refactor: reorganize connection module and fix pre-commit issues
- Reorganize atom/connection into subdirectories (fifo, serial, shared, ssh, tcp, tty, udp) - Reorganize atom/error into subdirectories (context, core, exception, handler, stacktrace) - Add new test files for algorithm, async, components, connection, error, extra, io, meta, system, web modules - Add new example files for algorithm, extra, io modules - Add new Python bindings for algorithm/math, async, extra/curl modules - Fix ruff B028: Add stacklevel to warnings.warn - Fix markdownlint MD025: Change duplicate H1 to H2 in SECURITY.md, CODE_OF_CONDUCT.md, CONTRIBUTING.md - Fix markdownlint MD029: Correct ordered list numbering - Fix markdownlint MD033: Escape angle brackets with backticks - Fix yamllint line-length: Break long lines in workflow files - Fix yamllint comments: Add proper spacing before inline comments - Update pre-commit config to disable document-start and truthy rules - Update CMakeLists.txt files for new module structure
1 parent 1989645 commit c6d0b8b

417 files changed

Lines changed: 59161 additions & 14384 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ATOM_INLINE void registerTest(std::string name, std::function<void()> func,
119119
- **C++20 Required**: Use concepts, ranges, source_location
120120
- **RAII Everywhere**: Smart pointers, automatic resource management
121121
- **Template Heavy**: Meta-programming in `atom/meta/` - extensive concept usage
122-
- **Error Propagation**: Use Result<T> types from `atom-error`, not exceptions in normal flow
122+
- **Error Propagation**: Use `Result<T>` types from `atom-error`, not exceptions in normal flow
123123
- **Documentation**: Doxygen format with `@brief`, `@param`, `@return`
124124
125125
When working on this codebase, always check module dependencies first, respect the build order, and follow the established patterns for testing and examples.

.github/workflows/code-quality.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77
branches: [main, develop]
88
schedule:
9-
- cron: "0 2 * * 1" # Weekly on Monday at 2 AM
9+
- cron: "0 2 * * 1" # Weekly on Monday at 2 AM
1010
workflow_dispatch:
1111

1212
env:
@@ -296,8 +296,9 @@ jobs:
296296
doxygen Doxyfile 2> doxygen-warnings.txt || true
297297
298298
# Check for undocumented functions
299-
find atom/ -name "*.hpp" -exec grep -l "^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*(" {} \; | \
300-
xargs -I {} sh -c 'echo "=== {} ==="; grep -n "^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*(" "{}" | head -5'
299+
PATTERN="^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*("
300+
find atom/ -name "*.hpp" -exec grep -l "$PATTERN" {} \; | \
301+
xargs -I {} sh -c 'echo "=== {} ==="; grep -n "$PATTERN" "{}" | head -5'
301302
302303
- name: Check README and documentation files
303304
run: |
@@ -361,7 +362,10 @@ jobs:
361362
echo "Validating test module configurations..."
362363
cd tests
363364
364-
for module_dir in algorithm async components connection containers error extra image io log memory meta search secret serial sysinfo system type utils web; do
365+
MODULES="algorithm async components connection containers error extra"
366+
MODULES="$MODULES image io log memory meta search secret serial"
367+
MODULES="$MODULES sysinfo system type utils web"
368+
for module_dir in $MODULES; do
365369
if [ -d "$module_dir" ]; then
366370
if [ -f "$module_dir/CMakeLists.txt" ]; then
367371
# Check if module uses standardized template
@@ -538,8 +542,9 @@ jobs:
538542
echo "- AddressSanitizer and Valgrind tests completed" >> quality-report.md
539543
540544
echo "## Documentation Quality" >> quality-report.md
541-
if [ -f reports/documentation-warnings/doxygen-warnings.txt ]; then
542-
echo "- Doxygen warnings: $(wc -l < reports/documentation-warnings/doxygen-warnings.txt) lines" >> quality-report.md
545+
DOXY_WARN="reports/documentation-warnings/doxygen-warnings.txt"
546+
if [ -f "$DOXY_WARN" ]; then
547+
echo "- Doxygen warnings: $(wc -l < $DOXY_WARN) lines" >> quality-report.md
543548
fi
544549
545550
echo "## Test Infrastructure Quality" >> quality-report.md

.github/workflows/dependency-update.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Dependency Updates
22

33
on:
44
schedule:
5-
- cron: "0 6 * * 1" # Weekly on Monday at 6 AM
5+
- cron: "0 6 * * 1" # Weekly on Monday at 6 AM
66
workflow_dispatch:
77
inputs:
88
update_type:
@@ -21,7 +21,10 @@ jobs:
2121
update-vcpkg:
2222
name: Update vcpkg Baseline
2323
runs-on: ubuntu-latest
24-
if: github.event_name == 'schedule' || github.event.inputs.update_type == 'all' || github.event.inputs.update_type == 'vcpkg'
24+
if: >-
25+
github.event_name == 'schedule' ||
26+
github.event.inputs.update_type == 'all' ||
27+
github.event.inputs.update_type == 'vcpkg'
2528
steps:
2629
- uses: actions/checkout@v4
2730
with:
@@ -98,7 +101,10 @@ jobs:
98101
update-submodules:
99102
name: Update Git Submodules
100103
runs-on: ubuntu-latest
101-
if: github.event_name == 'schedule' || github.event.inputs.update_type == 'all' || github.event.inputs.update_type == 'submodules'
104+
if: >-
105+
github.event_name == 'schedule' ||
106+
github.event.inputs.update_type == 'all' ||
107+
github.event.inputs.update_type == 'submodules'
102108
steps:
103109
- uses: actions/checkout@v4
104110
with:
@@ -148,7 +154,10 @@ jobs:
148154
update-python-deps:
149155
name: Update Python Dependencies
150156
runs-on: ubuntu-latest
151-
if: github.event_name == 'schedule' || github.event.inputs.update_type == 'all' || github.event.inputs.update_type == 'python'
157+
if: >-
158+
github.event_name == 'schedule' ||
159+
github.event.inputs.update_type == 'all' ||
160+
github.event.inputs.update_type == 'python'
152161
steps:
153162
- uses: actions/checkout@v4
154163
with:

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ jobs:
187187
- name: Determine test parameters
188188
id: test-params
189189
run: |
190-
if [ "${{ github.event.inputs.test_category }}" != "" ] && [ "${{ github.event.inputs.test_category }}" != "all" ]; then
190+
TEST_CAT="${{ github.event.inputs.test_category }}"
191+
if [ "$TEST_CAT" != "" ] && [ "$TEST_CAT" != "all" ]; then
191192
TEST_CATEGORY="${{ github.event.inputs.test_category }}"
192193
TEST_FLAG="--category $TEST_CATEGORY"
193194
elif [ "${{ github.event.inputs.test_module }}" != "" ]; then

.gitignore

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*.so.*
2626
*.dylib
2727
*.dll
28+
*.dll.a
2829

2930
# Fortran module files
3031
*.mod
@@ -40,6 +41,7 @@
4041
*.exe
4142
*.out
4243
*.app
44+
*.run
4345

4446
# Debug files
4547
*.dSYM/
@@ -52,23 +54,26 @@
5254
# -----------------------------------------------------------------------------
5355

5456
# Build directories
55-
build/
56-
build-msvc/
57-
cmake-build-*/
58-
out/
59-
_build/
60-
python/build-python/
57+
/build/
58+
/build-*/
59+
/build-msvc/
60+
/build_error/
61+
/build_serial/
62+
/cmake-build-*/
63+
/out/
64+
/_build/
65+
/python/build-python/
6166

6267
# CMake cache and generated files
63-
CMakeCache.txt
64-
CMakeFiles/
65-
CMakeScripts/
66-
cmake_install.cmake
67-
install_manifest.txt
68-
compile_commands.json
69-
CPackConfig.cmake
70-
CPackSourceConfig.cmake
71-
*.cmake
68+
/CMakeCache.txt
69+
/CMakeFiles/
70+
/CMakeScripts/
71+
/cmake_install.cmake
72+
/install_manifest.txt
73+
/compile_commands.json
74+
/CPackConfig.cmake
75+
/CPackSourceConfig.cmake
76+
/CMakeUserPresets.json
7277

7378
# CMake temporary files
7479
.cmake/
@@ -103,20 +108,21 @@ __pycache__/
103108

104109
# Distribution / packaging
105110
.Python
106-
build/
107-
build-*/
108-
develop-eggs/
109-
dist/
110-
downloads/
111-
eggs/
112-
.eggs/
113-
lib/
114-
lib64/
115-
parts/
116-
sdist/
117-
var/
118-
wheels/
119-
share/python-wheels/
111+
/.venv/
112+
/build/
113+
/build-*/
114+
/develop-eggs/
115+
/dist/
116+
/downloads/
117+
/eggs/
118+
/.eggs/
119+
/lib/
120+
/lib64/
121+
/parts/
122+
/sdist/
123+
/var/
124+
/wheels/
125+
/share/python-wheels/
120126
*.egg-info/
121127
.installed.cfg
122128
*.egg
@@ -239,13 +245,17 @@ cython_debug/
239245
*.vcxproj.filters
240246
*.VC.db
241247
*.VC.VC.opendb
248+
*.ipch
249+
*.opendb
250+
*.tlog
242251

243252
# IntelliJ IDEA / CLion / PyCharm
244253
.idea/
245254
*.iws
246255
*.iml
247256
*.ipr
248257
cmake-build-*/
258+
/.fleet/
249259

250260
# Xcode
251261
*.xcodeproj/
@@ -281,6 +291,7 @@ tramp
281291
# Sphinx documentation
282292
docs/_build/
283293
docs/build/
294+
docs/doctrees/
284295

285296
# Doxygen
286297
doc/html/
@@ -402,12 +413,18 @@ coverage/
402413

403414
# Test artifacts and temporary test files
404415
test_*.dat
405-
test_*.cpp
406-
test_*.c
416+
# Note: test_*.cpp in tests/ directory is NOT ignored (actual test files)
417+
# Only ignore test_*.cpp in root and non-test directories
418+
/test_*.cpp
419+
/test_*.c
407420
*.test
408421
test_output/
409422
test_results/
410423

424+
# Generated bindings/tests scratch
425+
/build_error/
426+
/build_serial/
427+
411428
# Configuration files with sensitive data
412429
config.local.*
413430
.env.local
@@ -483,6 +500,15 @@ test_package/
483500
python/Release/
484501
python/build-python/
485502

503+
# Editor caches
504+
/.clangd/
505+
/.ccls-cache/
506+
/.cache/
507+
508+
# Node tooling
509+
/node_modules/
510+
/.pnpm-store/
511+
486512
# -----------------------------------------------------------------------------
487513
# End of .gitignore
488514
# -----------------------------------------------------------------------------

.pre-commit-config.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ repos:
7272
- id: markdownlint
7373
args: ['--fix']
7474
files: \.md$
75-
exclude: ^(build/|vcpkg_installed/|\.augment/rules/|llmdoc/|\.claude/|example/async/README\.md|README\.md)
75+
exclude: >-
76+
^(build/|vcpkg_installed/|\.augment/rules/|llmdoc/|\.claude/|
77+
example/async/README\.md|README\.md|\.todo_list\.md)
7678
7779
# YAML linting
7880
- repo: https://github.com/adrienverge/yamllint
7981
rev: v1.35.1
8082
hooks:
8183
- id: yamllint
82-
args: ['-d', '{extends: default, rules: {line-length: {max: 120}}}']
84+
args: ['-d', '{extends: default, rules: {line-length: {max: 120}, document-start: disable, truthy: disable}}']
8385
files: \.(yaml|yml)$
84-
exclude: ^(build/|vcpkg_installed/)
86+
exclude: ^(build/|vcpkg_installed/|tests/components/\.github)

.todo_list.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
TODO: Expand tests for atom/algorithm module
2+
3+
1. Review algorithm implementations (all submodules) to identify functions/classes and edge cases.
4+
TODO:
5+
0. [x] Inspect repo status and scope changes
6+
1. [x] Stage all changes
7+
2. [ ] Remove generated artifacts and rerun pre-commit
8+
3. [ ] Fix remaining hook issues (formatting/lints/clang-format)
9+
4. [ ] Run tests as needed
10+
5. [ ] Commit with message and push to remote
11+
2. Review current tests under tests/algorithm to see coverage gaps.
12+
3. Draft test plan per module (core, compression, crypto, hash, math, optimization, signal, graphics, encoding, utils) and seek approval.

CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ project(
2222
DESCRIPTION "Foundational library for astronomical software"
2323
HOMEPAGE_URL "https://github.com/ElementAstro/Atom")
2424

25+
# -----------------------------------------------------------------------------
26+
# Use shared libraries for fmt to avoid ODR violations
27+
# -----------------------------------------------------------------------------
28+
set(fmt_SHARED_LIBS
29+
ON
30+
CACHE BOOL "Use fmt shared library")
31+
32+
# -----------------------------------------------------------------------------
33+
# Use compiled spdlog library to avoid ODR violations This ensures all modules
34+
# use the same spdlog library (not header-only)
35+
# -----------------------------------------------------------------------------
36+
set(ATOM_SPDLOG_TARGET
37+
"spdlog::spdlog"
38+
CACHE STRING "spdlog target to use")
39+
add_compile_definitions(SPDLOG_COMPILED_LIB SPDLOG_FMT_EXTERNAL)
40+
2541
# -----------------------------------------------------------------------------
2642
# Include CMake Modules
2743
# -----------------------------------------------------------------------------
@@ -268,7 +284,7 @@ endif()
268284
# Version Info Header
269285
# -----------------------------------------------------------------------------
270286
# Configure version information
271-
configure_atom_version(VERSION_VARIABLE PROJECT_VERSION)
287+
atom_configure_version(VERSION_VARIABLE PROJECT_VERSION)
272288

273289
# Also configure the version info header
274290
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/version_info.h.in

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ For answers to common questions about this code of conduct, see the FAQ at
127127
<https://www.contributor-covenant.org/faq>. Translations are available at
128128
<https://www.contributor-covenant.org/translations>.
129129

130-
# 贡献者公约行为准则
130+
## 贡献者公约行为准则
131131

132132
## 我们的承诺
133133

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
感谢您的贡献和支持!我们期待着您的代码、问题和建议,以使项目变得更好。
3535

36-
# Contributing Guidelines
36+
## Contributing Guidelines
3737

3838
Welcome to our project! Please read the following guidelines to ensure that your contributions align with the requirements of the project.
3939

0 commit comments

Comments
 (0)