[ 
https://issues.apache.org/jira/browse/AVRO-3381?focusedWorklogId=724568&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-724568
 ]

ASF GitHub Bot logged work on AVRO-3381:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Feb/22 15:30
            Start Date: 10/Feb/22 15:30
    Worklog Time Spent: 10m 
      Work Description: martin-g commented on a change in pull request #1530:
URL: https://github.com/apache/avro/pull/1530#discussion_r803775130



##########
File path: lang/csharp/src/apache/main/Generic/GenericDatumReader.cs
##########
@@ -159,17 +160,17 @@ public object CreateFixed(object reuse)
                     reuse : new GenericFixed(this.schema);
             }
 
-            public byte[] GetFixedBuffer( object f )
+            public byte[] GetFixedBuffer(object f)
             {
                 return ((GenericFixed)f).Value;
             }
         }
 
-        class GenericArrayAccess : ArrayAccess
+        private class GenericArrayAccess : ArrayAccess

Review comment:
       same

##########
File path: lang/csharp/src/apache/main/Generic/GenericDatumReader.cs
##########
@@ -87,7 +88,7 @@ protected override FixedAccess GetFixedAccess(FixedSchema 
readerSchema)
             return new GenericFixedAccess(readerSchema);
         }
 
-        class GenericEnumAccess : EnumAccess
+        private class GenericEnumAccess : EnumAccess

Review comment:
       what was the visibility until now ? package-private ?
   maybe better annotate it as Obsolete and say that it will become `private` 
in a future version ?!

##########
File path: lang/csharp/src/apache/main/Generic/GenericDatumReader.cs
##########
@@ -144,7 +145,7 @@ public void AddField(object record, string fieldName, int 
fieldPos, object field
             }
         }
 
-        class GenericFixedAccess : FixedAccess
+        private class GenericFixedAccess : FixedAccess

Review comment:
       same

##########
File path: lang/csharp/src/apache/main/Generic/PreresolvingDatumReader.cs
##########
@@ -120,18 +123,23 @@ private ReadItem ResolveReader(Schema writerSchema, 
Schema readerSchema)
             {
                 case Schema.Type.Null:
                     return ReadNull;
+
                 case Schema.Type.Boolean:
                     return ReadBoolean;
+
                 case Schema.Type.Int:
                     {
                         switch (readerSchema.Tag)
                         {
                             case Schema.Type.Long:
-                                return Read(d => (long) d.ReadInt());
+                                return Read(d => (long)d.ReadInt());

Review comment:
       personal opinion: it reads easier with the space between `(long)` and 
`d.`

##########
File path: lang/csharp/src/apache/main/Generic/GenericDatumReader.cs
##########
@@ -194,13 +195,13 @@ public void AddElements( object arrayObj, int elements, 
int index, ReadItem item
 
             private static void SizeTo(ref object array, int targetSize)
             {
-                var o = (object[]) array;
+                var o = (object[])array;
                 Array.Resize(ref o, targetSize);
                 array = o;
             }
         }
 
-        class GenericMapAccess : MapAccess
+        private class GenericMapAccess : MapAccess

Review comment:
       same

##########
File path: lang/csharp/src/apache/main/Specific/SpecificDatumWriter.cs
##########
@@ -113,56 +114,70 @@ protected override void WriteFixed(FixedSchema schema, 
object value, Encoder enc
         }
 
         /// <inheritdoc/>
-        protected override bool UnionBranchMatches( Schema sc, object obj )
+        protected override bool UnionBranchMatches(Schema sc, object obj)
         {
             if (obj == null && sc.Tag != Avro.Schema.Type.Null) return false;
             switch (sc.Tag)
             {
                 case Schema.Type.Null:
                     return obj == null;
+
                 case Schema.Type.Boolean:
                     return obj is bool;
+
                 case Schema.Type.Int:
                     return obj is int;
+
                 case Schema.Type.Long:
                     return obj is long;
+
                 case Schema.Type.Float:
                     return obj is float;
+
                 case Schema.Type.Double:
                     return obj is double;
+
                 case Schema.Type.Bytes:
                     return obj is byte[];
+
                 case Schema.Type.String:
                     return obj is string;
+
                 case Schema.Type.Error:
                 case Schema.Type.Record:
                     return obj is ISpecificRecord &&
                            ((obj as ISpecificRecord).Schema as 
RecordSchema).SchemaName.Equals((sc as RecordSchema).SchemaName);
+
                 case Schema.Type.Enumeration:
                     return obj.GetType().IsEnum && (sc as 
EnumSchema).Symbols.Contains(obj.ToString());
+
                 case Schema.Type.Array:
                     return obj is System.Collections.IList;
+
                 case Schema.Type.Map:
                     return obj is System.Collections.IDictionary;
+
                 case Schema.Type.Union:
                     return false;   // Union directly within another union not 
allowed!
                 case Schema.Type.Fixed:
                     return obj is SpecificFixed &&
                            ((obj as SpecificFixed).Schema as 
FixedSchema).SchemaName.Equals((sc as FixedSchema).SchemaName);
+
                 case Schema.Type.Logical:
                     return (sc as 
LogicalSchema).LogicalType.IsInstanceOfLogicalType(obj);
+
                 default:
                     throw new AvroException("Unknown schema type: " + sc.Tag);
             }
         }
 
-        class SpecificArrayAccess : ArrayAccess
+        private class SpecificArrayAccess : ArrayAccess

Review comment:
       I am not sure about this one

##########
File path: lang/csharp/src/apache/main/Generic/PreresolvingDatumWriter.cs
##########
@@ -340,7 +353,7 @@ protected int ResolveUnion(UnionSchema us, Schema[] 
branchSchemas, object obj)
         /// <returns>A new <see cref="AvroException"/> indicating a type 
mismatch.</returns>
         protected static AvroException TypeMismatch(object obj, string 
schemaType, string type)
         {
-            return new AvroException(type + " required to write against " + 
schemaType + " schema but found " + (null == obj ? "null" : 
obj.GetType().ToString()) );
+            return new AvroException(type + " required to write against " + 
schemaType + " schema but found " + (null == obj ? "null" : 
obj.GetType().ToString()));

Review comment:
       nit: line too long

##########
File path: lang/csharp/src/apache/perf/PerfTest.cs
##########
@@ -26,32 +27,32 @@
 
 namespace Avro.perf
 {
-    class Program
+    internal class Program

Review comment:
       I guess it is OK in `perf` module

##########
File path: lang/csharp/src/apache/main/Specific/ObjectCreator.cs
##########
@@ -259,87 +268,96 @@ private bool TryGetNullableItemTypeName(string name, out 
string itemTypeName)
         /// </exception>
         public Type GetType(Schema schema)
         {
-            switch(schema.Tag) {

Review comment:
       the rest is hard to review

##########
File path: lang/csharp/src/apache/main/Reflect/ReflectDefaultReader.cs
##########
@@ -417,7 +417,7 @@ protected override object ReadRecord(object reuse, 
RecordSchema writerSchema, Sc
                     Field rf;
                     if (rs.TryGetField(wf.Name, out rf))
                     {
-//                        obj = 
_classCache.GetClass(writerSchema).GetValue(rec, rf);
+                        //                        obj = 
_classCache.GetClass(writerSchema).GetValue(rec, rf);

Review comment:
       delete the white space between `//` and ` obj` ?

##########
File path: lang/csharp/src/apache/main/IO/Resolver.cs
##########
@@ -15,14 +15,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 using System;
 using System.Collections.Generic;
 using Newtonsoft.Json.Linq;
-using Newtonsoft.Json;
 
 namespace Avro.IO
 {
-    static class Resolver
+    internal static class Resolver

Review comment:
       non-functional ?

##########
File path: lang/csharp/src/apache/perf/PerfTest.cs
##########
@@ -26,32 +27,32 @@
 
 namespace Avro.perf
 {
-    class Program
+    internal class Program
     {
-        static void Main(string[] args)
+        private static void Main(string[] args)

Review comment:
       Does this still work ? Java won't work with private main()

##########
File path: lang/csharp/src/apache/main/Generic/GenericWriter.cs
##########
@@ -445,7 +461,7 @@ protected virtual void WriteFixed(FixedSchema es, object 
value, Encoder encoder)
         /// <returns>A new <see cref="AvroException"/> indicating a type 
mismatch.</returns>
         protected AvroException TypeMismatch(object obj, string schemaType, 
string type)
         {
-            return new AvroException(type + " required to write against " + 
schemaType + " schema but found " + (null == obj ? "null" : 
obj.GetType().ToString()) );
+            return new AvroException(type + " required to write against " + 
schemaType + " schema but found " + (null == obj ? "null" : 
obj.GetType().ToString()));

Review comment:
       the editor does not complain that this line is too long ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 724568)
    Time Spent: 1h 20m  (was: 1h 10m)

> Non functional changes to update styling in Avro solution
> ---------------------------------------------------------
>
>                 Key: AVRO-3381
>                 URL: https://issues.apache.org/jira/browse/AVRO-3381
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: csharp
>    Affects Versions: 1.11.0
>            Reporter: Kyle Schoonover
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Spacing formatting fixes. 
> Reference for formatting: [Code style formatting rules - .NET | Microsoft 
> Docs|https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules]
>  
> Add accessibility modifiers.  Make the accessibility explicit and not implied.
> Reference: [IDE0040: Add accessibility modifiers - .NET | Microsoft 
> Docs|https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0040]
>  
> Remove and sort using statements:  Sorting doesn't really do anything, but 
> the remove part will speed up code analysis tools.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to