This code is really hard to read…

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Rule #1 of code that doesnt make sense but works: Don't touch

avananana
Автор

The cleaning function is really effective! I used it and it cleaned the code by just deleting it.

exotwd
Автор

When you clicked readable, the whole config.values.keeplocale was gone. 😅 No more configurability, all for readability! 😂

CainKellye
Автор

I didn't know co-pilot could do tests, refactoring etc. This is cheating.

nanakwame
Автор

If you don't trust the code generated by co-pilot, let it generate a unit test?

lorenzo.
Автор

The ternaries are the least that's wrong with this code. Wtf is that inline assignment to a function parameter?

FlorianWendelborn
Автор

locale? What locale bro? This is America, the most maga robot ive ever seen

rodohale
Автор

"generate a unit test"
But if you generate a unit test based on erroneous code, the unit test will also be erroneous, which defeats the point of unit testing.

tdplay
Автор

"If suspicious of LLM accuracy, use LLM to generate tests"

Kiansjet
Автор

wait a minute, who uses var instead of let or const? O.o

Zagoorland
Автор

You could probably clean this block up really nicely wirh guard clauses.

redcrafterlppa
Автор

I thought you were going to talk about refactoring old legacy functions with 1000+ lines of code with the original writer gone from the company for 4+ years.

syamsarosa
Автор

The nested ternary is fine.
There are real problems with that code.

qmster
Автор

You need to check if there are tests for that part first, otherwise you may live in a nightmare next few weeks 😅

deadlyecho
Автор

Copy the code and paste in chatGPT asking for explanation.

migueljunqueira
Автор

Nested ternaries don't inherently make code less reasonable. It's just that it doesn't help in some situations, like this one.

AdroSlice
Автор

This prompt works well: "Can you turn all these ternaries into named boolean variables"

benaloney
Автор

Resharper can do it from the box, its just refactoring

CoolinarGameDeveloper
Автор

Cool! Didn't know about this. It basically turns CoPilot into ChatGPT++

unconv
Автор

How about allow 120 character lines and call it a day?

JonathanTheZombie