Skip to content

Commit

Permalink
Release 0.9.7 (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
belav authored Jun 26, 2021
1 parent fbebb34 commit 37e145a
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 6 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# 0.9.7

[diff](https://github.com/belav/csharpier/compare/0.9.6...0.9.7)

- New overload for `Doc.GroupWithId()` [#334](https://github.com/belav/csharpier/issues/334)
- Improve formatting by grouping parenthesized expressions and indenting them if they break. [#328](https://github.com/belav/csharpier/issues/328)
- Improve formatting of IsPattern in IfStatement [#327](https://github.com/belav/csharpier/issues/327)
- Improve formatting of the condition in a do-while [#326](https://github.com/belav/csharpier/issues/326)
- Always break statements without braces. [#303](https://github.com/belav/csharpier/issues/303)
- Empty Line being added with Array Type [#301](https://github.com/belav/csharpier/issues/301)
- Implicit Array Initializer does not format braces consistently with other statements. [#297](https://github.com/belav/csharpier/issues/297)
- Format checked like a invocation expression with an argument list [#270](https://github.com/belav/csharpier/issues/270)
- Attribute should newline before close paren [#257](https://github.com/belav/csharpier/issues/257)
- Tuple with VariableDeclaration [#251](https://github.com/belav/csharpier/issues/251)
- Record - does not format consistently with a class. [#233](https://github.com/belav/csharpier/issues/233)
- CSharpier.Playground should only publish with new released version [#224](https://github.com/belav/csharpier/issues/224)
- Attributes on parameters [#204](https://github.com/belav/csharpier/issues/204)
- Improve Lambda Formatting - indent expression body and break in a way to minimize new lines. [#176](https://github.com/belav/csharpier/issues/176)
- Format ObjectCreationExpression with Initializer consistently [#113](https://github.com/belav/csharpier/issues/113)
- Improve formatting of long Catch Clauses [#86](https://github.com/belav/csharpier/issues/86)

# 0.9.6

[diff](https://github.com/belav/csharpier/compare/0.9.5...0.9.6)
Expand Down
2 changes: 1 addition & 1 deletion CSharpier.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.9.6</Version>
<Version>0.9.7</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand Down
16 changes: 11 additions & 5 deletions Scripts/CreateReviewCodePRs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ param (
[string]$version
)

# TODO this could format from the root folder, so that it is easy to see if anything failed, but do all the git stuff in the repo specific folders.

# aspnetcore
# AspNetWebStack
# AutoMapper
Expand Down Expand Up @@ -39,21 +37,29 @@ foreach($folder in Get-ChildItem $csharpierRepos) {
Push-Location $folder.FullName
Write-Output $folder.FullName

#TODO git writes to stderr or some stupid shit
& git checkout main
& git reset --hard
& git branch -d $version
& git checkout -b $version
}

Push-Location $csharpierRepos

dotnet $csharpierProject\Src\CSharpier\bin\Release\net5.0\dotnet-csharpier.dll
dotnet $csharpierProject\Src\CSharpier\bin\Release\net5.0\dotnet-csharpier.dll

foreach($folder in Get-ChildItem $csharpierRepos)
{
Push-Location $folder.FullName
Write-Output $folder.FullName

& git add -A
& git commit -m $versionWithQuotes
& git push --set-upstream origin $version
#uses https://github.com/github/hub/releases
$newPr = & hub pull-request -b belav:main -m $versionWithQuotes
$newPr = & hub pull-request -b belav:main -m $versionWithQuotes
$prs += $newPr
Pop-Location
}


Write-Output $prs
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,111 @@ class ClassName
throw new NotImplementedException();
}
);

public void MapFrom<TResult>(Func<TSource, TDestination, TMember, TResult> mappingFunction)
{
if (true)
{
PropertyMapActions.Add(
pm =>
{
Expression<Func<
TSource,
TDestination,
TMember,
ResolutionContext,
TResult
>> expr = (src, dest, destMember, ctxt) =>
mappingFunction(src, dest, destMember);

pm.CustomMapFunction = expr;
}
);
}
}

public void Condition(
Func<ConditionParameters<TSource, TDestination, TMember>, bool> condition
) =>
PathMapActions.Add(
pm =>
{
Expression<Func<
TSource,
TDestination,
TMember,
TMember,
ResolutionContext,
bool
>> expr = (src, dest, srcMember, destMember, ctxt) =>
condition(
new ConditionParameters<TSource, TDestination, TMember>(
src,
dest,
srcMember,
destMember,
ctxt
)
);
pm.Condition = expr;
}
);

public override Type SourceType
{
get =>
_sourceType ??=
CustomMapExpression?.ReturnType
?? CustomMapFunction?.ReturnType
?? (
_sourceMembers.Length > 0
? _sourceMembers[_sourceMembers.Length - 1].GetMemberType()
: Parameter.ParameterType
);
protected set => _sourceType = value;
}

public static Expression IfNullElse(
this Expression expression,
Expression then,
Expression @else
) =>
expression.Type.IsValueType
? (
expression.Type.IsNullableType()
? Condition(
Property(expression, "HasValue"),
ToType(@else, then.Type),
then
)
: @else
)
: Condition(ReferenceEqual(expression, Null), then, ToType(@else, then.Type));

private bool VisitChildForCompare(Pair<XmlNode> tuple, ref int result)
{
int r;
return 0
!= (
result = (null == tuple.Item1)
? -1
: (null == tuple.Item2)
? +1
: 0
!= (
r = comparer.Compare(
tuple.Item1.LocalName,
tuple.Item2.LocalName
)
)
? r
: 0
!= (
r = comparer.Compare(
tuple.Item1.NamespaceURI,
tuple.Item2.NamespaceURI
)
) ? r : 0
);
}
}

0 comments on commit 37e145a

Please sign in to comment.