Skip to content

Support for dotted versions of the GitVersion config files by default #4432

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 5 commits into from
Feb 26, 2025

Conversation

Bi0T1N
Copy link
Contributor

@Bi0T1N Bi0T1N commented Feb 22, 2025

Description

Follow the convention of many other tools which use a leading dot for their configuration files, e.g. .gitignore, .editorconfig, .gitattributes, etc.

Related Issue

Closes #4431

Motivation and Context

With this change GitVersion will look for the following configuration files by default:
GitVersion.yml, GitVersion.yaml, .GitVersion.yml and .GitVersion.yaml (in this order)

How Has This Been Tested?

By extending the unit tests.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@arturcic arturcic self-requested a review February 22, 2025 13:24
Copy link
Member

@asbjornu asbjornu left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@Bi0T1N
Copy link
Contributor Author

Bi0T1N commented Feb 26, 2025

All suggestions applied and rebased to current main. 👍

@arturcic
Copy link
Member

please run dotnet format ./src/ --exclude **/AddFormats/ to fix formatting

@Bi0T1N
Copy link
Contributor Author

Bi0T1N commented Feb 26, 2025

please run dotnet format ./src/ --exclude **/AddFormats/ to fix formatting

Its the line you suggested: string?[] candidates = [this.ConfigurationFile, ..SupportedConfigFileNames];
Changing it to string?[] candidates = [this.ConfigurationFile, .. SupportedConfigFileNames]; fixes the warning but looks weird to me.

@arturcic
Copy link
Member

please run dotnet format ./src/ --exclude **/AddFormats/ to fix formatting

Its the line you suggested: string?[] candidates = [this.ConfigurationFile, ..SupportedConfigFileNames]; Changing it to string?[] candidates = [this.ConfigurationFile, .. SupportedConfigFileNames]; fixes the warning but looks weird to me.

string?[] it's because this.ConfigurationFile can be null, that's why we have where !candidate.IsNullOrWhiteSpace()

@Bi0T1N
Copy link
Contributor Author

Bi0T1N commented Feb 26, 2025

To make the linter happy you need to have a whitespace between the two dots .. and the variable SupportedConfigFileNames but that seems odd to me. However, fixed and pipeline succeeded now.

@arturcic arturcic merged commit bc53a41 into GitTools:main Feb 26, 2025
95 of 96 checks passed
Copy link
Contributor

mergify bot commented Feb 26, 2025

Thank you @Bi0T1N for your contribution!

@Bi0T1N Bi0T1N deleted the dotted_config branch February 26, 2025 21: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.

[Feature]: Support for dotted versions of the GitVersion config files by default
3 participants