Open
Conversation
yurii-litvinov
left a comment
There was a problem hiding this comment.
Тестов не хватает и в целом самое интересное закомментировано, но выглядит хорошо, в целом всё правильно.
| @@ -0,0 +1,2 @@ | |||
| // See https://aka.ms/new-console-template for more information | |||
| Console.WriteLine("Hello, World!"); | |||
| @@ -0,0 +1,297 @@ | |||
| namespace SecondTestTask; | |||
There was a problem hiding this comment.
Тут вот StyleCop дело говорит, стоило поправить его замечания сразу, это же быстро
| { | ||
| ArgumentNullException.ThrowIfNull(someClass); | ||
| var fileName = $"{ClearClassName(someClass)}.cs"; | ||
| //File.WriteAllText(fileName, GenerateCode(someClass), Encoding.UTF8); |
Comment on lines
+18
to
+21
| if (a == null || b == null) | ||
| { | ||
| throw new ArgumentNullException(); | ||
| } |
There was a problem hiding this comment.
Это лучше двумя отдельными ThrowIfNull
Comment on lines
+30
to
+31
| //DiffFields(a, b); | ||
| //DiffMethods(a, b); |
| sb.AppendLine(); | ||
| } | ||
|
|
||
| var nestedClasses = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic).Where(nt => nt.IsClass).OrderBy(nt => nt.Name).ToArray(); |
There was a problem hiding this comment.
Тут стоило проверить, что это не автогенерённый вложенный класс (они именуются с <>), иначе не скомпилится, если в исходном классе, например, есть лямбды с замыканиями
| private string FieldDeclaration(FieldInfo f) | ||
| { | ||
| var mods = new List<string> { GetMemberAccess(f) }; | ||
| if (f.IsStatic) mods.Add("static"); |
There was a problem hiding this comment.
Ещё бывают всякие readonly, const и т.п.
| { | ||
| var prefix = ""; | ||
| if (p.ParameterType.IsByRef) | ||
| prefix = p.IsOut ? "out " : "ref "; |
| if (t == typeof(object)) return "object"; | ||
|
|
||
| if (t.IsArray) | ||
| return TypeName(t.GetElementType()!) + "[]"; |
| } | ||
|
|
||
| var methods = type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | | ||
| BindingFlags.Static | BindingFlags.DeclaredOnly).Where(m=> !m.IsSpecialName).OrderBy(m => m.Name).ToArray(); |
There was a problem hiding this comment.
Конструкторы требуют особого внимания
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.