mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c715f458e | ||
|
|
90d93a57ee | ||
|
|
8da4a61eb7 | ||
|
|
f718370642 | ||
|
|
83c7af72bf |
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v2.3.3 (28-Apr-2023)
|
||||||
|
|
||||||
|
- Fixed an issue where the analyzers failed to load in some projects, due to targeting a Roslyn version that was too high.
|
||||||
|
|
||||||
## v2.3.2 (06-Apr-2023)
|
## v2.3.2 (06-Apr-2023)
|
||||||
|
|
||||||
- Added name-based ordering to subcommands when displayed in the help text. (Thanks [@CartBlanche](https://github.com/CartBlanche))
|
- Added name-based ordering to subcommands when displayed in the help text. (Thanks [@CartBlanche](https://github.com/CartBlanche))
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.4.1" />
|
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.4.1" />
|
||||||
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" PrivateAssets="all" />
|
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.2" PrivateAssets="all" />
|
||||||
<PackageReference Include="FluentAssertions" Version="6.10.0" />
|
<PackageReference Include="FluentAssertions" Version="6.11.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
|
|||||||
@@ -17,9 +17,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
|
<!-- Make sure to target the lowest possible version of the compiler for wider support -->
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.0.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="PolyShim" Version="1.1.0" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.0.0" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="PolyShim" Version="1.2.0" PrivateAssets="all" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -24,7 +24,7 @@ public class OptionMustBeRequiredIfPropertyRequiredAnalyzer : AnalyzerBase
|
|||||||
if (property.ContainingType is null)
|
if (property.ContainingType is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!property.IsRequired)
|
if (!property.IsRequired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var option = CommandOptionSymbol.TryResolve(property);
|
var option = CommandOptionSymbol.TryResolve(property);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class OptionMustHaveUniqueNameAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class OptionMustHaveUniqueShortNameAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ParameterMustBeLastIfNonRequiredAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ParameterMustBeLastIfNonScalarAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ParameterMustBeRequiredIfPropertyRequiredAnalyzer : AnalyzerBase
|
|||||||
if (property.ContainingType is null)
|
if (property.ContainingType is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!property.IsRequired)
|
if (!property.IsRequired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var parameter = CommandParameterSymbol.TryResolve(property);
|
var parameter = CommandParameterSymbol.TryResolve(property);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ParameterMustBeSingleIfNonRequiredAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ParameterMustBeSingleIfNonScalarAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class ParameterMustHaveUniqueNameAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class ParameterMustHaveUniqueOrderAnalyzer : AnalyzerBase
|
|||||||
.ContainingType
|
.ContainingType
|
||||||
.GetMembers()
|
.GetMembers()
|
||||||
.OfType<IPropertySymbol>()
|
.OfType<IPropertySymbol>()
|
||||||
.Where(m => !m.Equals(property, SymbolEqualityComparer.Default))
|
.Where(m => !m.Equals(property))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
foreach (var otherProperty in otherProperties)
|
foreach (var otherProperty in otherProperties)
|
||||||
|
|||||||
@@ -34,6 +34,17 @@ internal static class RoslynExtensions
|
|||||||
.FirstOrDefault(i => i.ConstructedFrom.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T)?
|
.FirstOrDefault(i => i.ConstructedFrom.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T)?
|
||||||
.TypeArguments[0];
|
.TypeArguments[0];
|
||||||
|
|
||||||
|
// Detect if the property is required through roundabout means so as to not have to take dependency
|
||||||
|
// on higher versions of the C# compiler.
|
||||||
|
public static bool IsRequired(this IPropertySymbol property) => property
|
||||||
|
// Can't rely on the RequiredMemberAttribute because it's generated by the compiler, not added by the user,
|
||||||
|
// so we have to check for the presence of the `required` modifier in the syntax tree instead.
|
||||||
|
.DeclaringSyntaxReferences
|
||||||
|
.Select(r => r.GetSyntax())
|
||||||
|
.OfType<PropertyDeclarationSyntax>()
|
||||||
|
.SelectMany(p => p.Modifiers)
|
||||||
|
.Any(m => m.IsKind((SyntaxKind)8447));
|
||||||
|
|
||||||
public static bool IsAssignable(this Compilation compilation, ITypeSymbol source, ITypeSymbol destination) =>
|
public static bool IsAssignable(this Compilation compilation, ITypeSymbol source, ITypeSymbol destination) =>
|
||||||
compilation.ClassifyConversion(source, destination).Exists;
|
compilation.ClassifyConversion(source, destination).Exists;
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.4.1" />
|
<PackageReference Include="Basic.Reference.Assemblies.Net70" Version="1.4.1" />
|
||||||
<PackageReference Include="CliWrap" Version="3.6.0" />
|
<PackageReference Include="CliWrap" Version="3.6.1" />
|
||||||
<PackageReference Include="FluentAssertions" Version="6.10.0" />
|
<PackageReference Include="FluentAssertions" Version="6.11.0" />
|
||||||
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" PrivateAssets="all" />
|
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.2" PrivateAssets="all" />
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
<PackageTags>command line executable interface framework parser arguments cli app application net core</PackageTags>
|
<PackageTags>command line executable interface framework parser arguments cli app application net core</PackageTags>
|
||||||
<PackageProjectUrl>https://github.com/Tyrrrz/CliFx</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Tyrrrz/CliFx</PackageProjectUrl>
|
||||||
<PackageReleaseNotes>https://github.com/Tyrrrz/CliFx/blob/master/Changelog.md</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/Tyrrrz/CliFx/blob/master/Changelog.md</PackageReleaseNotes>
|
||||||
<PackageReadmeFile>Readme.md</PackageReadmeFile>
|
|
||||||
<PackageIcon>favicon.png</PackageIcon>
|
<PackageIcon>favicon.png</PackageIcon>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
@@ -21,13 +20,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="../Readme.md" Pack="true" PackagePath="" Visible="false" />
|
|
||||||
<None Include="../favicon.png" Pack="true" PackagePath="" Visible="false" />
|
<None Include="../favicon.png" Pack="true" PackagePath="" Visible="false" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
|
||||||
<PackageReference Include="PolyShim" Version="1.1.0" PrivateAssets="all" />
|
<PackageReference Include="PolyShim" Version="1.2.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
|
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.3.2</Version>
|
<Version>2.3.3</Version>
|
||||||
<Company>Tyrrrz</Company>
|
<Company>Tyrrrz</Company>
|
||||||
<Copyright>Copyright (C) Oleksii Holub</Copyright>
|
<Copyright>Copyright (C) Oleksii Holub</Copyright>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
|
|||||||
Reference in New Issue
Block a user