--- a/eric6/DataViews/CodeMetrics.py Sun Apr 11 16:53:48 2021 +0200 +++ b/eric6/DataViews/CodeMetrics.py Sun Apr 11 18:45:10 2021 +0200 @@ -233,9 +233,11 @@ stats.indent(tok) elif tok.type == DEDENT: stats.dedent(tok) - elif tok.type == KEYWORD: - if tok.text in ("class", "def"): - stats.push(parser.tokenlist[idx + 1].text, tok.row) + elif ( + tok.type == KEYWORD and + tok.text in ("class", "def") + ): + stats.push(parser.tokenlist[idx + 1].text, tok.row) # collect overall statistics summarize(total, 'lines', parser.lines)