Skip to content

Commit

Permalink
some improvements per feedback (#7018)
Browse files Browse the repository at this point in the history
* some improvements
1. make CHANGELOG.MD to CHANGELOG.md for case-sensitive environment
2. move spec version bump from Other Changes to Features Added group

* small improve
  • Loading branch information
RodgeFu authored Sep 27, 2023
1 parent d2b0f98 commit ddc4e10
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
- Removed property method 'Set' for 'String PropertyToChangeToGet' in type Azure.ResourceManager.AppService.TestProperty
- Removed type 'Azure.ResourceManager.AppService.TypeToBeDeleted'

### Other Changes
### Features Added

- spec upgraded

### Other Changes

- Azure Core upgraded
- Azure RM upgraded
- Obsoleted method 'Void StaticMethodToBeObsoleted()' in type Azure.ResourceManager.AppService.StaticTypeToBeObsoleted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ public Release GenerateReleaseNote(string version, string date, List<ChangeCatog
Logger.Error("Breaking change detected which is not expected\n" + breakingGroup.ToString());
}

ReleaseNoteGroup othersGroup = new ReleaseNoteGroup("Other Changes");
ReleaseNoteGroup featureAddedGroup = new ReleaseNoteGroup("Features Added");
if (SpecVersionChange != null)
othersGroup.Notes.Add(new ReleaseNote(SpecVersionChange.Description, PREFIX));
featureAddedGroup.Notes.Add(new ReleaseNote(SpecVersionChange.Description, PREFIX));
if (featureAddedGroup.Notes.Count > 0)
report.Groups.Add(featureAddedGroup);

ReleaseNoteGroup othersGroup = new ReleaseNoteGroup("Other Changes");
if (AzureCoreVersionChange != null)
othersGroup.Notes.Add(new ReleaseNote(AzureCoreVersionChange.Description, PREFIX));
if (AzureResourceManagerVersionChange != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class Context
public string AzureCoreChangeLogGithubKey => "sdk/core/Azure.Core/CHANGELOG.md";
public string AzureCoreChangeLogMdFile => Path.Combine(RepoRoot, AzureCoreChangeLogGithubKey);

public string AzureResourceManagerChangeLogGithubKey => "sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.MD";
public string AzureResourceManagerChangeLogGithubKey => "sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.md";
public string AzureResourceManagerChangeLogMdFile => Path.Combine(RepoRoot, AzureResourceManagerChangeLogGithubKey);

public bool IsPreview => Helper.IsPreviewRelease(this.ReleaseVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void MergeByOverwrite(Release to)

private void MergeByGrup(Release to)
{
foreach(var fromGroup in this.Groups)
foreach (var fromGroup in this.Groups)
{
var found = to.Groups.FirstOrDefault(g => g.Name == fromGroup.Name);
if (found != null)
Expand All @@ -81,21 +81,24 @@ private void MergeByGrup(Release to)

private void MergeByLine(Release to)
{
foreach(var fromGroup in this.Groups)
foreach (var fromGroup in this.Groups)
{
var toGroup = to.Groups.FirstOrDefault(g => string.Equals(g.Name, fromGroup.Name, StringComparison.OrdinalIgnoreCase));
if(toGroup == null)
if (toGroup == null)
{
to.Groups.Add(fromGroup);
}
else
{
foreach(var fromItem in fromGroup.Notes)
int indexToInsert = toGroup.Notes.FindLastIndex(n => !string.IsNullOrEmpty(n.Note)) + 1;
int lastNonEmptyIndex = fromGroup.Notes.FindLastIndex(n => !string.IsNullOrEmpty(n.Note));
for (int i = lastNonEmptyIndex; i >= 0; i--)
{
var fromItem = fromGroup.Notes[i];
var toItem = toGroup.Notes.FirstOrDefault(t => string.Equals(fromItem.ToString(), t.ToString(), StringComparison.OrdinalIgnoreCase));
if(toItem == null)
if (toItem == null)
{
toGroup.Notes.Add(fromItem);
toGroup.Notes.Insert(indexToInsert, fromItem);
}
else
{
Expand Down Expand Up @@ -133,7 +136,7 @@ public static List<Release> FromChangelog(string changelog)
Release curRelease = firstRelease!;

ReleaseNoteGroup curGroup = new ReleaseNoteGroup("");
for(i = i+1; i < lines.Length; i++)
for (i = i + 1; i < lines.Length; i++)
{
if (ReleaseNoteGroup.TryParseGroupTitle(lines[i], out ReleaseNoteGroup? newGroup))
{
Expand Down

0 comments on commit ddc4e10

Please sign in to comment.