Skip to content

[feat] implement aliases#262

Merged
antond-weta merged 3 commits intoAcademySoftwareFoundation:mainfrom
antond-weta:aliases
Mar 30, 2026
Merged

[feat] implement aliases#262
antond-weta merged 3 commits intoAcademySoftwareFoundation:mainfrom
antond-weta:aliases

Conversation

@antond-weta
Copy link
Copy Markdown
Contributor

Description

Implements the camera aliases functionality.
Depends on AcademySoftwareFoundation/rawtoaces-data#25

Tests

There is full test coverage.

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable. (Check if there is no
    need to update the documentation, for example if this is a bug fix that
    doesn't change the API.)
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format before submitting, I definitely will look at the CI
    test that runs clang-format and fix anything that it highlights as being
    nonconforming.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.74%. Comparing base (22eb4f3) to head (8d640c2).

Files with missing lines Patch % Lines
src/rawtoaces_core/rawtoaces_core.cpp 89.61% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #262      +/-   ##
==========================================
+ Coverage   90.67%   90.74%   +0.06%     
==========================================
  Files          17       17              
  Lines        3326     3435     +109     
  Branches      500      531      +31     
==========================================
+ Hits         3016     3117     +101     
- Misses        310      318       +8     
Files with missing lines Coverage Δ
include/rawtoaces/rawtoaces_core.h 100.00% <ø> (ø)
src/rawtoaces_util/image_converter.cpp 78.42% <100.00%> (+0.53%) ⬆️
src/rawtoaces_core/rawtoaces_core.cpp 98.39% <89.61%> (-1.24%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22eb4f3...8d640c2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
path.append( "aliases.json" );

if ( std::filesystem::exists( path ) )
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

returning true when path doesn't exist is expected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is an optional file, it is not expected to be in every directory specified in the paths list.

std::ifstream ifstream( path );
if ( !ifstream.is_open() )
{
std::cerr << "Warning: cannot open file " << path.string()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we do show warning when you can't open the path, but we don't dow it for when it doesn't exist in a first place. expected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Expected. This path is actually the only bit which is not covered in unit tests. Same with the spectral files. May want to come up with a way to test if an existing file can't be opened, like restricting file permissions, or something. Will leave this for later, as it is not directly related to this feature.

Comment thread src/rawtoaces_core/rawtoaces_core.cpp Outdated
continue;
}

nlohmann::json file_data = nlohmann::json::parse( ifstream );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can parse fail? Throw?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, might add a try


if ( !mapping_data.contains( type ) )
{
continue;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for some "skip" we show warning, for others we don't

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The section is optional, being omitted from an aliases files is a normal case. We just go to the next file.

{
bool has_prefix = true;

if ( make.length() <= model.length() )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am very confused about this logic. If it is correct we should leave comment here.
I've looked at the test and I still don't get it it =))
It is very specific, logic in this method. Has a lot of assumptions and build in heuristics. And it is not very clear. Comment would def. be needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is trivial really. Skip the prefix if it matches the make name, or the make name + whitespace.
"Canon" + "Canon R5" = "Canon R5"
"Canon R5" + "Canon R5" = "Canon R5"
"Canon" + "Canon_R5" = "Canon Canon_R5"

Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
@antond-weta antond-weta merged commit bbbb815 into AcademySoftwareFoundation:main Mar 30, 2026
22 checks passed
@antond-weta antond-weta deleted the aliases branch March 30, 2026 05:02
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.

3 participants