cgag / loc

Count lines of code quickly.
MIT License
2.31k stars 126 forks source link

Lisp documentation strings are counted as code #19

Closed syll-dev closed 6 years ago

syll-dev commented 7 years ago

This lisp code :

(defun f (x y)
"Adds two numbers."
  (+ x y))

is (roughly) equivalent to this java code :

/** Adds two numbers. */
public int f (int x, int y)
{
    return x + y ;
}

In Lisp, "Adds two numbers." is a documentation string, equivalent to javadoc in java. I think this should not be counted as code but as comment instead. Other documentation strings are more difficult to catch, but for functions, methods, macros, ... the problem is the same.

Maybe lines with only a { or a } should not be counted at all in java, but this a a problem only for langages comparisons...

cgag commented 7 years ago

These unfortunately seem pretty painful to work around without basically writing parsers for languages with docstrings :\ . I think I'm going to probably ignore it for now and possibly forever.

anntzer commented 6 years ago

FTR the same issue occurs for Python.