Skip to content

Handle empty TranslationInfo tag properly when parsing Settings.xml#402

Merged
pmachapman merged 1 commit intomasterfrom
translation_info_parsing
Apr 14, 2026
Merged

Handle empty TranslationInfo tag properly when parsing Settings.xml#402
pmachapman merged 1 commit intomasterfrom
translation_info_parsing

Conversation

@pmachapman
Copy link
Copy Markdown
Collaborator

@pmachapman pmachapman commented Apr 8, 2026

Fixes #401.

I tested by modifying the Settings.xml file manually. If you think this should have its own test, we will need another test project in the file system, as none of the file system calls go through an abstraction layer.


This change is Reviewable

@pmachapman pmachapman requested review from Enkidu93 and ddaspit April 8, 2026 22:51
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.02%. Comparing base (812aa48) to head (deb7e5f).

Files with missing lines Patch % Lines
...chine/Corpora/ParatextProjectSettingsParserBase.cs 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #402      +/-   ##
==========================================
+ Coverage   73.00%   73.02%   +0.01%     
==========================================
  Files         439      439              
  Lines       36693    36693              
  Branches     5038     5039       +1     
==========================================
+ Hits        26789    26794       +5     
+ Misses       8789     8787       -2     
+ Partials     1115     1112       -3     

☔ 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.

Copy link
Copy Markdown
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

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

I think it would be helpful to have a test fixture for ParatextProjectSettingsParserBase to test this kind of logic. We can create a memory-based implementation for testing purposes. MemoryParatextProjectFileHandler already exists.

@ddaspit reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on Enkidu93).

Copy link
Copy Markdown
Collaborator

@Enkidu93 Enkidu93 left a comment

Choose a reason for hiding this comment

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

@Enkidu93 reviewed 1 file and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on pmachapman).

@pmachapman pmachapman force-pushed the translation_info_parsing branch from e690bc5 to deb7e5f Compare April 12, 2026 22:21
Copy link
Copy Markdown
Collaborator Author

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

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

I think it would be helpful to have a test fixture for ParatextProjectSettingsParserBase to test this kind of logic. We can create a memory-based implementation for testing purposes. MemoryParatextProjectFileHandler already exists.

Thanks - done.

@pmachapman made 1 comment.
Reviewable status: 1 of 4 files reviewed, all discussions resolved (waiting on ddaspit and Enkidu93).

Copy link
Copy Markdown
Collaborator

@Enkidu93 Enkidu93 left a comment

Choose a reason for hiding this comment

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

@Enkidu93 reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on pmachapman).


tests/SIL.Machine.Tests/Corpora/MemoryParatextProjectFileHandler.cs line 14 at r2 (raw file):

        if (fileName is "usfm.sty" or "usfm_sb.sty")
            return new UsfmStylesheet(fileName);
        throw new NotImplementedException();

Is it better do you think to throw a NotSupportedException() here now?

Copy link
Copy Markdown
Collaborator Author

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

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

@pmachapman made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on Enkidu93).


tests/SIL.Machine.Tests/Corpora/MemoryParatextProjectFileHandler.cs line 14 at r2 (raw file):

Previously, Enkidu93 (Eli C. Lowry) wrote…

Is it better do you think to throw a NotSupportedException() here now?

Semantically a NotSupportedException is the right choice, however looking over the code, NotImplementedException is the exception used in cases such as this. I think it is OK to keep it as-is for consistency's sake, but if you feel strongly about it, I can change it.

Copy link
Copy Markdown
Collaborator

@Enkidu93 Enkidu93 left a comment

Choose a reason for hiding this comment

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

@Enkidu93 made 1 comment and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on pmachapman).


tests/SIL.Machine.Tests/Corpora/MemoryParatextProjectFileHandler.cs line 14 at r2 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

Semantically a NotSupportedException is the right choice, however looking over the code, NotImplementedException is the exception used in cases such as this. I think it is OK to keep it as-is for consistency's sake, but if you feel strongly about it, I can change it.

I see. Searching the code base, it looks like we use both (e.g. in FeatureModel we use not supported). Many of the existing NotImplementedExceptions look like remnants of my work. I'm fine with leaving it as-is, but I think you're also welcome to just update to using NotSupportedException in these instances if you like.

Copy link
Copy Markdown
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

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

:lgtm:

@ddaspit reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on pmachapman).

@pmachapman pmachapman merged commit a272952 into master Apr 14, 2026
4 checks passed
@pmachapman pmachapman deleted the translation_info_parsing branch April 14, 2026 19:04
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.

Port 'Handle empty TranslationInfo tag properly when parsing Settings.xml'

4 participants