[
https://issues.apache.org/jira/browse/AVRO-3497?focusedWorklogId=759415&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-759415
]
ASF GitHub Bot logged work on AVRO-3497:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Apr/22 17:08
Start Date: 20/Apr/22 17:08
Worklog Time Spent: 10m
Work Description: KyleSchoonover commented on code in PR #1653:
URL: https://github.com/apache/avro/pull/1653#discussion_r854368702
##########
lang/csharp/src/apache/main/Generic/GenericEnum.cs:
##########
@@ -70,10 +70,12 @@ public GenericEnum(EnumSchema schema, string value)
/// <inheritdoc/>
public override bool Equals(object obj)
{
- if (obj == this) return true;
- return (obj != null && obj is GenericEnum)
- ? Value.Equals((obj as GenericEnum).Value,
System.StringComparison.Ordinal)
- : false;
+ if (obj == this)
+ {
+ return true;
+ }
+
+ return obj != null && obj is GenericEnum && Value.Equals((obj as
GenericEnum).Value, System.StringComparison.Ordinal);
}
Review Comment:
It's an interesting problem:
https://codeql.github.com/codeql-query-help/csharp/cs-equals-uses-is/
Updating the code. I will evaluate the code base after this PR.
Issue Time Tracking
-------------------
Worklog Id: (was: 759415)
Time Spent: 50m (was: 40m)
> Fix IDE0075 Simplify conditional expression
> -------------------------------------------
>
> Key: AVRO-3497
> URL: https://issues.apache.org/jira/browse/AVRO-3497
> Project: Apache Avro
> Issue Type: Sub-task
> Components: csharp
> Reporter: Kyle Schoonover
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> {code:java}
> // dotnet_style_prefer_simplified_boolean_expressions = true
> var result1 = M1() && M2();
> var result2 = M1() || M2();
> // dotnet_style_prefer_simplified_boolean_expressions = false
> var result1 = M1() && M2() ? true : false;
> var result2 = M1() ? true : M2(); {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)