Skip to content

Refactor config #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 14, 2021
Merged

Refactor config #457

merged 13 commits into from
Dec 14, 2021

Conversation

Lee-W
Copy link
Member

@Lee-W Lee-W commented Dec 8, 2021

Description

  • refactor(conventional_commits): remove duplicate patterns and import from defaults
  • refactor(defaults):
    • add CzSettings and Questions TypedDict
    • add Settings typeddict
    • move bump_map, bump_pattern, commit_parser from defaults to ConventionalCommitsCz
    • import TypedDict from type_extensions for backward compatibility
    • annoate OrderedDict through 'OrderedDict' for 3.6 compatibility
  • style
    • enforce warn_return_any check
    • disable disallow_untyped_decorators for tests
    • add return type to all functions
  • test: move default config to top level conftest.py
  • style: format code base with latest black
  • build(poetry): update black version for python 3.9 and upgrade least support python version to python 3.6.2

Checklist

  • Add test cases to all the changes you introduce
  • Run ./script/format and ./script/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

no new features has been added. all the functionality should be the same as it used to be

Steps to Test This Pull Request

Additional context

#424, #153

@Lee-W Lee-W requested a review from woile December 8, 2021 06:43
@Lee-W
Copy link
Member Author

Lee-W commented Dec 8, 2021

@woile this branch will need to wait for #456 to be merged. Although this is ready to be reviewed, I'm thinking of adding the functionality of validating config (#300) and overriding customize config in base config (related to #264 (comment)). do you think I should finish all those features then send them to you? or do you want me to create separate PRs for those functionalities?

@woile
Copy link
Member

woile commented Dec 8, 2021

This looks good, I would go one step at a time.
I would definitely update the documentation, specially to mention the new data types when building a custom commitizen ruler.
Using questions(...) -> list: is quite intuitive because everyone knows what a list is. If using Questions it should be documented and explained that it is basically the same as a list, what do you think?

@Lee-W
Copy link
Member Author

Lee-W commented Dec 8, 2021

One of the goals of this and the following PRs is to remove Generic type annotation and go for specific ones. So I would prefer to use either Question or Iterable[MutableMapping[str, Any]]. I'll add the documentation to address it these days. Will change this branch from draft to ready when I've done so.

@Lee-W Lee-W marked this pull request as draft December 8, 2021 11:14
@codecov
Copy link

codecov bot commented Dec 8, 2021

Codecov Report

Merging #457 (c29873a) into master (65645e0) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #457      +/-   ##
==========================================
+ Coverage   97.92%   97.96%   +0.04%     
==========================================
  Files          39       39              
  Lines        1395     1424      +29     
==========================================
+ Hits         1366     1395      +29     
  Misses         29       29              
Flag Coverage Δ
unittests 97.96% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commitizen/changelog.py 95.77% <ø> (ø)
commitizen/bump.py 100.00% <100.00%> (ø)
commitizen/commands/init.py 91.66% <100.00%> (ø)
commitizen/config/base_config.py 100.00% <100.00%> (ø)
commitizen/config/json_config.py 100.00% <100.00%> (ø)
commitizen/config/toml_config.py 100.00% <100.00%> (ø)
commitizen/config/yaml_config.py 100.00% <100.00%> (ø)
commitizen/cz/base.py 100.00% <100.00%> (ø)
...en/cz/conventional_commits/conventional_commits.py 100.00% <100.00%> (ø)
commitizen/cz/customize/customize.py 94.23% <100.00%> (+0.11%) ⬆️
... and 4 more

Continue to review full report at Codecov.

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

@woile
Copy link
Member

woile commented Dec 8, 2021

Sounds good to me 💪🏻 looking forward

@Lee-W Lee-W marked this pull request as ready for review December 8, 2021 15:16
@Lee-W
Copy link
Member Author

Lee-W commented Dec 8, 2021

I've updated the content in docs/customization.md Could you please check whether I need to add it to elsewhere? Thanks!

@woile
Copy link
Member

woile commented Dec 8, 2021

I think is good. The commit has a typo only 😅

@Lee-W
Copy link
Member Author

Lee-W commented Dec 9, 2021

Do you mean the missing s after expect? If so, I've fixed that. If not so, could please you point it out 😱

@Lee-W
Copy link
Member Author

Lee-W commented Dec 13, 2021

As this is approved, and I tried to address the typo. I plan to merge this one late today

@Lee-W Lee-W merged commit 2f160dc into master Dec 14, 2021
@Lee-W Lee-W deleted the refactor-config branch December 14, 2021 01:31
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.

2 participants