Skip to content

applying const correctness#669

Merged
K20shores merged 2 commits intomainfrom
227-const-correctness
Nov 14, 2025
Merged

applying const correctness#669
K20shores merged 2 commits intomainfrom
227-const-correctness

Conversation

@K20shores
Copy link
Copy Markdown
Collaborator

Closes #227

I used clang-tidy to target our source folder

cmake -B build -S . -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS="-isysroot $(xcrun --show-sdk-path) -stdlib=libc++"

run-clang-tidy -p build/ -checks='-*,misc-const-correctness' -source-filter='^(?!.*_deps/).*\.cpp$' -fix

@K20shores K20shores linked an issue Nov 13, 2025 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown
Contributor

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 94.91525% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.26%. Comparing base (e3dedd4) to head (d4595ce).

Files with missing lines Patch % Lines
src/tuvx/tuvx.cpp 16.66% 5 Missing ⚠️
src/tuvx/profile.cpp 66.66% 2 Missing ⚠️
src/micm/parse.cpp 50.00% 1 Missing ⚠️
src/micm/state_c_interface.cpp 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #669      +/-   ##
==========================================
+ Coverage   78.24%   78.26%   +0.02%     
==========================================
  Files          54       54              
  Lines        6857     6866       +9     
==========================================
+ Hits         5365     5374       +9     
  Misses       1492     1492              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request applies const correctness improvements across the codebase using clang-tidy's misc-const-correctness check. The changes add const qualifiers to local variables that are not modified after initialization, improving code safety and clarity.

  • Applies const qualifiers to immutable variables throughout the codebase
  • Improves code formatting in v1_parse.cpp for better readability
  • Identifies one incorrect const application that would cause compilation issues

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/util.cpp Added const to string and size_t variables used for error messages and index mapping
src/tuvx/tuvx.cpp Added const to calculation results and count variables
src/tuvx/profile.cpp Added const to string and numeric variables returned from internal functions
src/tuvx/grid.cpp Added const to section count variable
src/test/unit/tuvx/tuvx_c_api.cpp Added const to test dimension and stream count variables
src/test/unit/micm/parser.cpp Added const to chemistry objects and expected test values
src/test/unit/micm/micm_wrapper.cpp Added const to chemistry configuration and time step
src/test/unit/micm/micm_c_api.cpp Added const to test parameters, indices, and calculated values
src/test/unit/component_versions.cpp Added const to string length variable
src/test/unit/carma/carma_c_api.cpp Added const to version strings and CARMA objects in tests
src/micm/v1_parse.cpp Added const to gas_phase and parameters; improved formatting of builder chains
src/micm/v0_parse.cpp Added const to index and parameter variables
src/micm/state_c_interface.cpp Added const to error messages and map/size return values
src/micm/parse.cpp Added const to version and error message variables
src/micm/micm_c_interface.cpp Added const to chemistry configuration and string conversions
src/micm/micm.cpp Added const to error message string
src/micm/cuda_availability.cpp Incorrectly added const to device_count which is modified via pointer
src/micm/convert_v0_to_v1.cpp Added const to parsed mechanism object
src/component_versions.cpp Added const to string length variables
src/carma/carma_state.cpp Added const to wavelength bin count

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@K20shores K20shores merged commit b539719 into main Nov 14, 2025
85 of 87 checks passed
@K20shores K20shores deleted the 227-const-correctness branch November 14, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Const correctness

4 participants