MHN
Add a comment on Hacker News →
1 of 23 comments
  1. Maybe I'm doing things wrong, but I assume this tool is meant to focus on cognetive complexity and not things like code quality, transpiling or performance, but if that's true then why does this:

    (score is 7)
    function get_first_user(data) {
    first_user = data[0];
    return first_user;
    }

    Score better than this:

    (score is 8)
    function get_first_user(data: User[]): Result<User> {
    first_user = data[0];
    return first_user;
    }

    I mean, I know that the type annotations is what gives the lower score, but I would argue that the latter has the lower cognetive complexity.