Skip to content

Running scc --min crash with divide by zero error #223

@viblo

Description

@viblo

Describe the bug
Running scc with the --min argument on my code base results in a divide by zero error

panic: runtime error: integer divide by zero

goroutine 36 [running]:
github.com/boyter/scc/processor.CountStats(0xc0020fbe00)
        /Users/bb100123/Documents/kablamo/scc/processor/workers.go:578 +0x1547
github.com/boyter/scc/processor.processFile(0xc0020fbe00, 0xc0026026c0)
        /Users/bb100123/Documents/kablamo/scc/processor/workers.go:731 +0x139
github.com/boyter/scc/processor.fileProcessorWorker.func1(0xc0000a0180, 0xc000200000, 0xc000200008, 0xc000200010, 0xc0000a01e0, 0xc000200020)
        /Users/bb100123/Documents/kablamo/scc/processor/workers.go:660 +0x2f8
created by github.com/boyter/scc/processor.fileProcessorWorker
        /Users/bb100123/Documents/kablamo/scc/processor/workers.go:631 +0x105

To Reproduce

Unfortunately I cant share the code thats causing this (2m+ lines of company code), hopefully you will get some clue by the stack trace.

I run scc --min or scc --min-gen. I tried some other options and they work as expected..

Expected behavior

No crash :)

Desktop (please complete the following information):

  • OS: Windows
  • Version: 2.13.0

ps. SCC is great, just found it the other day while looking for easy to install and fast alternative to cloc, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions