-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore empty lines #8
Comments
The linecount including newlines is intended. Since in many cases people wouldn't try to workaround by removing newlines, and newlines are usually there because there's a lot of different things happening and still make you scroll trough the function a lot. If you don't want funlen to consider whitespace it would probably be best to disable the check on lines and instead use only the check on statements, which looks at the number of statements in a function rather than how many lines those statements take up. An example, this is 2 statements but 5 lines. func main() {
a := 1
fmt.Println(
`a:`, a,
)
} |
I'm talking about an empty line, not a new line 😉 func main() {
fmt.Println("foo")
fmt.Println("bar")
} func main() {
fmt.Println("foo")
fmt.Println("bar")
} |
🤔 maybe I did a wrong analysis, I try to reproduce a real case. |
package main
import "fmt"
func main() {
fmt.Println("foo")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
fmt.Println("bar")
} So it's related to |
So now I understand your explanation, thank you 👍 Note for other users: to disable |
funlen
counts lines, but if you 2 functions with the same effective lines of code, one can produce a report and the other not, only because there are empty lines.By following this rule, you promote the fact to remove the empty lines, I'm not sure this is expected.
I will great if you can, at least, add an option to ignore empty line from the count or just don't add the empty lines to the counters.
The text was updated successfully, but these errors were encountered: