Skip to content

[python] refactor yaml file parser#8701

Merged
caishunfeng merged 4 commits into
apache:devfrom
zhongjiajie:py-fix-yaml-config-without-comment
Mar 7, 2022
Merged

[python] refactor yaml file parser#8701
caishunfeng merged 4 commits into
apache:devfrom
zhongjiajie:py-fix-yaml-config-without-comment

Conversation

@zhongjiajie
Copy link
Copy Markdown
Member

  • Change yaml parser package to ruamel.yaml
  • Refactor configuration.py module
  • And file.py to write file locally
  • Add more tests on it

close: #8593

* Change yaml parser package to ruamel.yaml
* Refactor configuration.py module
* And file.py to write file locally
* Add more tests on it

close: apache#8593
@zhongjiajie zhongjiajie self-assigned this Mar 4, 2022
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 4, 2022

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.30%. Comparing base (c8b5d1e) to head (6e288b4).
⚠️ Report is 2861 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #8701      +/-   ##
============================================
+ Coverage     45.29%   45.30%   +0.01%     
- Complexity     4073     4075       +2     
============================================
  Files           700      700              
  Lines         27050    27050              
  Branches       2894     2894              
============================================
+ Hits          12251    12255       +4     
+ Misses        13645    13643       -2     
+ Partials       1154     1152       -2     

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

@zhongjiajie
Copy link
Copy Markdown
Member Author

PTAL @devosend @jieguangzhou Thanks

path = Path(to_path)
if create and not path.parent.exists():
path.parent.mkdir(parents=True)
if not path.exists():
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.

When create param is False and the parent path does not exist, it will raise an error.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch, I would try to fix it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fix it 6e288b4 Please take a look

* Fix error logic
* And tests to avoid regression
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@devosend
Copy link
Copy Markdown
Contributor

devosend commented Mar 6, 2022

LGTM

@zhongjiajie
Copy link
Copy Markdown
Member Author

@caishunfeng @songjianet PTAL thanks

@caishunfeng caishunfeng merged commit 5c64078 into apache:dev Mar 7, 2022
@zhongjiajie zhongjiajie deleted the py-fix-yaml-config-without-comment branch March 7, 2022 04:37
@zhongjiajie
Copy link
Copy Markdown
Member Author

Thanks for reviewing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][python] Refactor cli config dict mechnism

4 participants