3 ms·
Great, a whole new way to automatically introduce bugs through code duplication. From the examples: body: text=${text} `text` isn't properly encoded, wha
by quink 5y ago
Great, a whole new way to automatically introduce bugs through code duplication.
From the examples:
body: text=${text}
`text` isn't properly encoded, what if it has a `=`?
rows, err := db.Query("SELECT category, COUNT(category), AVG(value) FROM tasks GROUP BY category")
if err != nil {
return nil, err
}
defer rows.Close()
shouldn't we want to cleanly `rows.Close()` even if there was an error?
float(value)
where `value` is a currency. Doesn't Python have a Decimal class for this?
create_table :shipping_addresses do |t|
that's an auto-generated table, that one's debatable but for starters a `zip` fields makes it American only. And doesn't the customer have an e-mail address instead of a shipping address?
var date1InMillis = date1.getTime();
But what about the time-zone offset?
I could go on, but literally the first five examples I looked at are buggy in some way.
Edit:
const markers: { [language:string]: CommentMarker } = {
javascript: { start: '//', end: ''},
Wow.
Edit 2:
function collaborators_map(json: any): Map<string, Set<string>> {
Not exactly buggy, but 8 lines of tedium.
What about
new Map(json.map(({name, collaborators}) => [name, new Set(collaborators)]))
instead?
Edit 3:
const images = document.querySelectorAll('img');
for (let i = 0; i < images.length; i++) {
if (!images[i].hasAttribute('alt')) {
I mean, I get it, it's auto-generate code. Maybe in the future they can narrow it down to auto-generating good code.
document.querySelectorAll('img:not([alt])').forEach(
(or)
img:not([alt]) { border: 1px solid red; }
(or)
eslint-plugin-jsx-a11y because that maybe that img was rendered through react.
(or)
it should really be an `outline` because we don't want this to reflow the page and we can. And maybe a will-change.