Skip to content

Commit

Permalink
Remove redundant checks for attributes which have AllowMultiple = false
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinungf committed Oct 5, 2024
1 parent 573f723 commit fe1b130
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ private bool TryGetCellStyleAttribute(
AttributeData attribute,
CancellationToken token)
{
if (_result.CellStyle is not null)
return false;

var args = attribute.ConstructorArguments;
if (args is not [{ Value: string value } arg])
return false;

Check warning on line 39 in SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs

View check run for this annotation

Codecov / codecov/patch

SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs#L39

Added line #L39 was not covered by tests
Expand All @@ -59,9 +56,6 @@ private bool TryGetCellValueConverterAttribute(
ITypeSymbol propertyType,
CancellationToken token)
{
if (_result.CellValueConverter is not null)
return false;

var args = attribute.ConstructorArguments;
if (args is not [{ Value: INamedTypeSymbol converterTypeSymbol }])
return false;

Check warning on line 61 in SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs

View check run for this annotation

Codecov / codecov/patch

SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs#L61

Added line #L61 was not covered by tests
Expand Down Expand Up @@ -94,9 +88,6 @@ private bool TryGetCellValueTruncateAttribute(
ITypeSymbol propertyType,
CancellationToken token)
{
if (_result.CellValueTruncate is not null)
return false;

if (propertyType.SpecialType != SpecialType.System_String)
{
diagnostics.ReportUnsupportedPropertyTypeForAttribute(attribute, propertyType, token);
Expand All @@ -121,9 +112,6 @@ private bool TryGetColumnHeaderAttribute(
AttributeData attribute,
CancellationToken token)
{
if (_result.ColumnHeader is not null)
return false;

var args = attribute.ConstructorArguments;
if (args is [{ Value: string } arg])
_result.ColumnHeader = new ColumnHeader(arg.ToCSharpString());
Expand Down Expand Up @@ -162,9 +150,6 @@ private bool TryGetColumnHeaderAttribute(

private bool TryGetColumnOrderAttribute(AttributeData attribute)
{
if (_result.ColumnOrder is not null)
return false;

var args = attribute.ConstructorArguments;
if (args is not [{ Value: int attributeValue }])
return false;

Check warning on line 155 in SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs

View check run for this annotation

Codecov / codecov/patch

SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs#L155

Added line #L155 was not covered by tests
Expand All @@ -177,9 +162,6 @@ private bool TryGetColumnWidthAttribute(
AttributeData attribute,
CancellationToken token)
{
if (_result.ColumnWidth is not null)
return false;

var args = attribute.ConstructorArguments;
if (args is not [{ Value: double attributeValue }])
return false;

Check warning on line 167 in SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs

View check run for this annotation

Codecov / codecov/patch

SpreadCheetah.SourceGenerator/Helpers/PropertyAnalyzer.cs#L167

Added line #L167 was not covered by tests
Expand Down

0 comments on commit fe1b130

Please sign in to comment.