Page MenuHomeDevCentral

Read correctly empty configuration file
ClosedPublic

Authored by dereckson on Sep 25 2025, 17:00.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 14, 12:36
Unknown Object (File)
Wed, Jan 14, 12:36
Unknown Object (File)
Wed, Jan 14, 10:46
Unknown Object (File)
Tue, Jan 13, 15:13
Unknown Object (File)
Tue, Jan 13, 15:01
Unknown Object (File)
Tue, Jan 13, 11:03
Unknown Object (File)
Mon, Jan 12, 08:59
Unknown Object (File)
Sun, Jan 11, 12:14
Subscribers
None

Details

Summary

When a configuration file exists but is empty, YAML parser returns None.

This change returns an empty dict to represent the empty configuration.

This fixes the following issue for empty config file:

File "/home/dereckson/dev/python/general/lib64/python3.13/site-packages/mergedictionaries/app/app.py", line 118, in <lambda>
  self.context["config"].get("git", []), self.context["git"]
  ^^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'get'

Test Plan
  • create an empty configuration file
  • merge-dictionaries --extract

Diff Detail

Repository
rMD Merge dev dictionaries
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc/mergedictionaries/app/app.py:66E501flake8 E501
Errorsrc/mergedictionaries/app/app.py:103E501flake8 E501
Unit
No Test Coverage
Branch
empty-git-config-issue
Build Status
Buildable 5973
Build 6255: arc lint + arc unit

Event Timeline

dereckson created this revision.
This revision is now accepted and ready to land.Sep 25 2025, 17:00
This revision was landed with ongoing or failed builds.Sep 25 2025, 17:01
This revision was automatically updated to reflect the committed changes.