kevinushey / sourcetools

Tools for reading, tokenizing, and parsing R code.
MIT License
77 stars 3 forks source link

consider more diagnostics 'checkers' #14

Open kevinushey opened 8 years ago

kevinushey commented 8 years ago

We currently have a couple simple diagnostics checkers:

if (x = 1) { ... }     # using '=' instead of the probably intended '=='; although note that this is a parse error
if (x == NULL) { ... } # use 'is.null()'

What other similar code smells are out there?

kevinushey commented 8 years ago

We should warn about unused comparison results, e.g.

x == 10
for (i in seq_len(x)) { ... }

The user likely intended to write x = 10.