-
Notifications
You must be signed in to change notification settings - Fork 0
second test #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
second test #7
Conversation
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тестов не хватает и в целом самое интересное закомментировано, но выглядит хорошо, в целом всё правильно.
| @@ -0,0 +1,2 @@ | |||
| // See https://aka.ms/new-console-template for more information | |||
| Console.WriteLine("Hello, World!"); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(
| @@ -0,0 +1,297 @@ | |||
| namespace SecondTestTask; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут вот StyleCop дело говорит, стоило поправить его замечания сразу, это же быстро
| { | ||
| ArgumentNullException.ThrowIfNull(someClass); | ||
| var fileName = $"{ClearClassName(someClass)}.cs"; | ||
| //File.WriteAllText(fileName, GenerateCode(someClass), Encoding.UTF8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(
| if (a == null || b == null) | ||
| { | ||
| throw new ArgumentNullException(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это лучше двумя отдельными ThrowIfNull
| //DiffFields(a, b); | ||
| //DiffMethods(a, b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут стоило проверить, что это не автогенерённый вложенный класс (они именуются с <>), иначе не скомпилится, если в исходном классе, например, есть лямбды с замыканиями
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ещё бывают всякие readonly, const и т.п.
| { | ||
| var prefix = ""; | ||
| if (p.ParameterType.IsByRef) | ||
| prefix = p.IsOut ? "out " : "ref "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| if (t == typeof(object)) return "object"; | ||
|
|
||
| if (t.IsArray) | ||
| return TypeName(t.GetElementType()!) + "[]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| } | ||
|
|
||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Конструкторы требуют особого внимания
No description provided.