Skip to content

Commit f72fb22

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c136681 commit f72fb22

21 files changed

Lines changed: 449 additions & 449 deletions

.github/workflows/coverage.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
jobs:
1717
coverage:
1818
runs-on: ubuntu-latest
19-
19+
2020
steps:
2121
- name: Checkout code
2222
uses: actions/checkout@v4
@@ -111,51 +111,51 @@ jobs:
111111
script: |
112112
const fs = require('fs');
113113
const path = require('path');
114-
114+
115115
// Read coverage data
116116
const coverageFile = 'coverage/unified/coverage.json';
117117
if (!fs.existsSync(coverageFile)) {
118118
console.log('Coverage file not found');
119119
return;
120120
}
121-
121+
122122
const coverage = JSON.parse(fs.readFileSync(coverageFile, 'utf8'));
123123
const overall = coverage.overall.coverage_percentage;
124124
const cpp = coverage.cpp.coverage_percentage;
125125
const python = coverage.python.coverage_percentage;
126-
126+
127127
// Read badges
128128
let badges = '';
129129
if (fs.existsSync('coverage_badges.md')) {
130130
badges = fs.readFileSync('coverage_badges.md', 'utf8').trim();
131131
}
132-
132+
133133
const comment = `## 📊 Coverage Report
134-
134+
135135
${badges}
136-
136+
137137
| Language | Coverage | Lines Covered | Total Lines |
138138
|----------|----------|---------------|-------------|
139139
| **Overall** | **${overall.toFixed(1)}%** | ${coverage.overall.covered_lines.toLocaleString()} | ${coverage.overall.total_lines.toLocaleString()} |
140140
| C++ | ${cpp.toFixed(1)}% | ${coverage.cpp.covered_lines.toLocaleString()} | ${coverage.cpp.total_lines.toLocaleString()} |
141141
| Python | ${python.toFixed(1)}% | ${coverage.python.covered_lines.toLocaleString()} | ${coverage.python.total_lines.toLocaleString()} |
142-
142+
143143
📈 [View detailed coverage report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
144-
144+
145145
${overall >= process.env.COVERAGE_MINIMUM ? '✅' : '❌'} Coverage ${overall >= process.env.COVERAGE_MINIMUM ? 'meets' : 'below'} minimum threshold of ${process.env.COVERAGE_MINIMUM}%
146146
`;
147-
147+
148148
// Find existing comment
149149
const { data: comments } = await github.rest.issues.listComments({
150150
owner: context.repo.owner,
151151
repo: context.repo.repo,
152152
issue_number: context.issue.number,
153153
});
154-
155-
const existingComment = comments.find(comment =>
154+
155+
const existingComment = comments.find(comment =>
156156
comment.body.includes('📊 Coverage Report')
157157
);
158-
158+
159159
if (existingComment) {
160160
await github.rest.issues.updateComment({
161161
owner: context.repo.owner,
@@ -177,16 +177,16 @@ jobs:
177177
python -c "
178178
import json
179179
import sys
180-
180+
181181
with open('coverage/unified/coverage.json', 'r') as f:
182182
data = json.load(f)
183-
183+
184184
overall = data['overall']['coverage_percentage']
185185
threshold = float('${{ env.COVERAGE_MINIMUM }}')
186-
186+
187187
print(f'Overall coverage: {overall:.1f}%')
188188
print(f'Minimum threshold: {threshold}%')
189-
189+
190190
if overall < threshold:
191191
print(f'❌ Coverage {overall:.1f}% is below minimum threshold {threshold}%')
192192
sys.exit(1)
@@ -198,7 +198,7 @@ jobs:
198198
runs-on: ubuntu-latest
199199
needs: coverage
200200
if: github.ref == 'refs/heads/main'
201-
201+
202202
steps:
203203
- name: Checkout code
204204
uses: actions/checkout@v4

cmake/CoverageConfig.cmake

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ function(setup_target_coverage target_name)
1111
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
1212
target_compile_options(${target_name} PRIVATE --coverage)
1313
target_link_libraries(${target_name} PRIVATE --coverage)
14-
14+
1515
# Add target-specific coverage properties
1616
set_target_properties(${target_name} PROPERTIES
1717
COVERAGE_ENABLED TRUE
1818
)
19-
19+
2020
message(STATUS "Coverage enabled for target: ${target_name}")
2121
endif()
2222
endif()
@@ -49,35 +49,35 @@ function(create_module_coverage_target module_name)
4949
if(NOT ATOM_ENABLE_COVERAGE OR NOT LCOV_PROGRAM OR NOT GENHTML_PROGRAM)
5050
return()
5151
endif()
52-
52+
5353
string(TOUPPER ${module_name} MODULE_UPPER)
5454
if(NOT ATOM_BUILD_${MODULE_UPPER})
5555
return()
5656
endif()
57-
57+
5858
set(MODULE_COVERAGE_DIR "${CMAKE_BINARY_DIR}/coverage/${module_name}")
5959
set(MODULE_COVERAGE_INFO "${MODULE_COVERAGE_DIR}/${module_name}_coverage.info")
6060
set(MODULE_COVERAGE_CLEANED "${MODULE_COVERAGE_DIR}/${module_name}_coverage_cleaned.info")
6161
set(MODULE_COVERAGE_HTML "${MODULE_COVERAGE_DIR}/html")
62-
62+
6363
file(MAKE_DIRECTORY ${MODULE_COVERAGE_DIR})
64-
64+
6565
add_coverage_exclude_patterns()
66-
66+
6767
add_custom_target(coverage-${module_name}
6868
# Reset counters
6969
COMMAND ${LCOV_PROGRAM} --directory . --zerocounters
70-
70+
7171
# Run module-specific tests
7272
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -R ".*${module_name}.*"
73-
73+
7474
# Capture coverage data
7575
COMMAND ${LCOV_PROGRAM} --directory . --capture --output-file ${MODULE_COVERAGE_INFO}
76-
76+
7777
# Clean coverage data
7878
COMMAND ${LCOV_PROGRAM} --remove ${MODULE_COVERAGE_INFO} ${COVERAGE_EXCLUDE_PATTERNS}
7979
--output-file ${MODULE_COVERAGE_CLEANED}
80-
80+
8181
# Generate HTML report
8282
COMMAND ${GENHTML_PROGRAM} ${MODULE_COVERAGE_CLEANED}
8383
--output-directory ${MODULE_COVERAGE_HTML}
@@ -87,11 +87,11 @@ function(create_module_coverage_target module_name)
8787
--demangle-cpp
8888
--function-coverage
8989
--branch-coverage
90-
90+
9191
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
9292
COMMENT "Generating coverage report for ${module_name} module"
9393
)
94-
94+
9595
message(STATUS "Created coverage target: coverage-${module_name}")
9696
endfunction()
9797

@@ -100,43 +100,43 @@ function(setup_coverage_reporting)
100100
if(NOT ATOM_ENABLE_COVERAGE)
101101
return()
102102
endif()
103-
103+
104104
# Verify compiler support
105105
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
106106
message(WARNING "Coverage analysis requires GCC or Clang compiler")
107107
return()
108108
endif()
109-
109+
110110
# Find required tools
111111
find_program(GCOV_PROGRAM gcov)
112112
find_program(LCOV_PROGRAM lcov)
113113
find_program(GENHTML_PROGRAM genhtml)
114-
114+
115115
if(NOT GCOV_PROGRAM)
116116
message(WARNING "gcov not found - coverage analysis disabled")
117117
return()
118118
endif()
119-
119+
120120
if(NOT LCOV_PROGRAM)
121121
message(WARNING "lcov not found - HTML reports disabled")
122122
return()
123123
endif()
124-
124+
125125
if(NOT GENHTML_PROGRAM)
126126
message(WARNING "genhtml not found - HTML reports disabled")
127127
return()
128128
endif()
129-
129+
130130
# Set global coverage flags
131131
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage" PARENT_SCOPE)
132132
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -fprofile-arcs -ftest-coverage" PARENT_SCOPE)
133133
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage" PARENT_SCOPE)
134134
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" PARENT_SCOPE)
135-
135+
136136
# Create coverage output directory
137137
set(COVERAGE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/coverage")
138138
file(MAKE_DIRECTORY ${COVERAGE_OUTPUT_DIR})
139-
139+
140140
message(STATUS "Coverage reporting configured successfully")
141141
message(STATUS " - gcov: ${GCOV_PROGRAM}")
142142
message(STATUS " - lcov: ${LCOV_PROGRAM}")

docs/TESTING_CONVENTIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ python/tests/
3535

3636
### C++ Test Files
3737
- **Pattern**: `test_<module_name>.cpp` or `test_<specific_feature>.cpp`
38-
- **Examples**:
38+
- **Examples**:
3939
- `test_algorithm.cpp`
4040
- `test_memory_pool.cpp`
4141
- `test_hash.cpp`
@@ -132,11 +132,11 @@ TEST_F(MemoryPoolTest, AllocateExceedingBlockSize) {
132132
```python
133133
class TestMemoryPool:
134134
"""Test cases for memory pool functionality.
135-
135+
136136
Tests various aspects of memory pool including allocation,
137137
deallocation, and memory management edge cases.
138138
"""
139-
139+
140140
def test_allocate_exceeding_block_size(self):
141141
"""Test that allocation exceeding block size raises exception."""
142142
# Test implementation

python/tests/conftest.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,49 @@ def atom_modules():
2222
modules.append("algorithm")
2323
except ImportError:
2424
pass
25-
25+
2626
try:
2727
import atom_connection
2828
modules.append("connection")
2929
except ImportError:
3030
pass
31-
31+
3232
try:
3333
import atom_error
3434
modules.append("error")
3535
except ImportError:
3636
pass
37-
37+
3838
try:
3939
import atom_io
4040
modules.append("io")
4141
except ImportError:
4242
pass
43-
43+
4444
try:
4545
import atom_search
4646
modules.append("search")
4747
except ImportError:
4848
pass
49-
49+
5050
try:
5151
import atom_sysinfo
5252
modules.append("sysinfo")
5353
except ImportError:
5454
pass
55-
55+
5656
try:
5757
import atom_type
5858
modules.append("type")
5959
except ImportError:
6060
pass
61-
61+
6262
try:
6363
import atom_web
6464
modules.append("web")
6565
except ImportError:
6666
pass
67-
67+
6868
return modules
6969

7070
@pytest.fixture
@@ -105,11 +105,11 @@ def pytest_collection_modifyitems(config, items):
105105
# Add slow marker to tests with 'slow' in name
106106
if "slow" in item.name.lower():
107107
item.add_marker(pytest.mark.slow)
108-
108+
109109
# Add integration marker to tests with 'integration' in name
110110
if "integration" in item.name.lower():
111111
item.add_marker(pytest.mark.integration)
112-
112+
113113
# Add benchmark marker to tests with 'benchmark' in name
114114
if "benchmark" in item.name.lower():
115115
item.add_marker(pytest.mark.benchmark)

python/tests/pytest.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool:pytest]
22
minversion = 7.0
3-
addopts =
3+
addopts =
44
-ra
55
-q
66
--strict-markers
@@ -11,7 +11,7 @@ addopts =
1111
--cov-report=term-missing
1212
--cov-branch
1313
--cov-fail-under=80
14-
testpaths =
14+
testpaths =
1515
python/tests
1616
markers =
1717
slow: marks tests as slow (deselect with '-m "not slow"')

python/tests/test_algorithm.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
ALGORITHM_AVAILABLE = False
1717

1818
pytestmark = pytest.mark.skipif(
19-
not ALGORITHM_AVAILABLE,
19+
not ALGORITHM_AVAILABLE,
2020
reason="atom_algorithm module not available"
2121
)
2222

2323
class TestAlgorithmModule:
2424
"""Test cases for the algorithm module."""
25-
25+
2626
def test_module_import(self):
2727
"""Test that the algorithm module can be imported."""
2828
assert atom_algorithm is not None
29-
29+
3030
def test_module_attributes(self):
3131
"""Test that the module has expected attributes."""
3232
# Check if the module has some expected functions/classes
3333
# This will depend on what's actually exposed in the Python bindings
3434
assert hasattr(atom_algorithm, '__doc__')
35-
35+
3636
@pytest.mark.slow
3737
def test_algorithm_performance(self):
3838
"""Test algorithm performance (marked as slow)."""
@@ -41,15 +41,15 @@ def test_algorithm_performance(self):
4141

4242
class TestHashFunctions:
4343
"""Test cases for hash functions if available."""
44-
44+
4545
def test_hash_functions_exist(self):
4646
"""Test that hash functions are available."""
4747
# This will depend on what's actually exposed
4848
pass
4949

5050
class TestMathFunctions:
5151
"""Test cases for math functions if available."""
52-
52+
5353
def test_math_functions_exist(self):
5454
"""Test that math functions are available."""
5555
# This will depend on what's actually exposed
@@ -58,7 +58,7 @@ def test_math_functions_exist(self):
5858
@pytest.mark.benchmark
5959
class TestAlgorithmBenchmarks:
6060
"""Benchmark tests for algorithm module."""
61-
61+
6262
def test_algorithm_benchmark(self, benchmark):
6363
"""Benchmark algorithm performance."""
6464
# Placeholder for benchmark tests

0 commit comments

Comments
 (0)