boyter / scc Goto Github PK
View Code? Open in Web Editor NEWSloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
License: MIT License
Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
License: MIT License
See naufraghi/loc@3604026 in loc for some details.
Thanks for the great app.
using scc version 1.6.0, I noted the following correct behaviour
➜ drgo scc --wl=go
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks Complexity
-------------------------------------------------------------------------------
Go 377 47522 34848 7085 5589 6683
-------------------------------------------------------------------------------
Total 377 47522 34848 7085 5589 6683
-------------------------------------------------------------------------------
Estimated Cost to Develop $1,124,299
Estimated Schedule Effort 16.040798 months
Estimated People Required 8.302536
-------------------------------------------------------------------------------
But this does not work
drgo scc rosewood --wl=go
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks Complexity
-------------------------------------------------------------------------------
Go 57 5532 3723 1313 496 820
HTML 48 3464 3078 0 386 0
Plain Text 9 1523 1463 0 60 0
JSON 6 702 702 0 0 0
Markdown 5 267 201 0 66 0
ASP.NET 4 69 69 0 0 1
CSS 4 295 211 33 51 0
JavaScript 1 18 12 3 3 2
Makefile 1 56 32 9 15 1
gitignore 1 68 39 13 16 0
-------------------------------------------------------------------------------
Total 136 11994 9530 1371 1093 824
-------------------------------------------------------------------------------
Estimated Cost to Develop $288,166
Estimated Schedule Effort 9.562139 months
Estimated People Required 3.569788
-------------------------------------------------------------------------------
Please let me know if you would like any assistance.
Thanks
/salah
This option would make scc a drop-in replacement for cloc in automated flows.
I tried to add language support for SAS and Stata, see diff.
I ran go generate
and go build
after, but these do not show up in the list when doing scc --languages
nor in the list when running the main version.
Running go 1.11 on windows.
Any advice?
This might be the against the purpose of this project, but personally I've been too spoiled from ag
When I was using it to measure a few of my projects, it spent an awfully long time working in node_modules and dist, when I just wanted to see the results of my TypeScript. So hiding gitignore files will make the results more accurate in this case
On the other hand, it is interesting to see the cumulative amount of work done in an open source project. So maybe it should just be a flag
Describe the bug
Missing a language.
To Reproduce
scc
against https://github.com/Microsoft/BosqueLanguage/blob/master/ref_impl/src/test/apps/nbody/main.bsq it will not recognise the language https://www.microsoft.com/en-us/research/project/bosque-programming-language/Expected behavior
Should be able to count it.
It would be great to have stats on average method/class length and total number of methods/classes.
a homebrew formula would be nice
I like the tool a lot so far ! thanks
Consider accepting multiple regular expressions instead of just one. Example
scc --not-match ".*\.csv" --not-match "specialDirectory/.*\.txt" .
Currently scc
just uses the last specified regex (--not-match) option.
Seems that when you have more than three exclusions, it forgets the first three and starts over.
i.e. the output of:
C:\Tools> scc X:\path\to\repo
is the same as
C:\Tools> scc -e thing1-e thing2 -e thing3 -e nonexistent X:\path\to\repo
Similarly, the output of (assuming thing4 exists):
C:\Tools> scc -e thing4 X:\path\to\repo
is the same as:
C:\Tools> scc -e thing1-e thing2 -e thing3 -e thing4 X:\path\to\repo
Also, exceptions (both file and directory) after a directory exclusion seem to drop the directory exclusion - but reversing the order works if one of them is a file.
Describe the bug
When I run scc
a command line directly from repo directory i am getting correct statistics but when I run it like mentioned below I also get ASP.NET in statistics. How come that can happen?
To Reproduce
scc
as command line.$ scc /path/to/a/repo
Expected behavior
I expect it to show statistics about Golang, markdown, makefile and gitignore only.
Desktop (please complete the following information):
See https://raw.githubusercontent.com/corretto/corretto-8/da7e192d1f7a73340cb1ec9b2f08645f8d189769/src/jdk/src/share/native/sun/java2d/cmm/lcms/cmscgats.c for instance
$ wget https://raw.githubusercontent.com/corretto/corretto-8/da7e192d1f7a73340cb1ec9b2f08645f8d189769/src/jdk/src/share/native/sun/java2d/cmm/lcms/cmscgats.c
$ ./scc cmscgats.c
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────
Total 0 0 0 0 0 0
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $0
Estimated Schedule Effort 0.000000 months
Estimated People Required NaN
───────────────────────────────────────────────────────────────────────────────
but
$ perl ../cloc-1.80.pl cmscgats.c
1 text file.
1 unique file.
0 files ignored.
github.com/AlDanial/cloc v 1.80 T=0.02 s (63.5 files/s, 179074.4 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C 1 811 212 1796
Hi guys, thank you for building the project, i really enjoyed it.
Here are some ideas/suggestions.
Is there something that can be done about this?
detecting html or xml inside js and starting a react-mode?
is it over estimated?
under-estimated?
Should there be a link explaining the numbers and how they were calculated
simply, so that when the managers see the numbers they don't run away afraid?
Can the tool add some default ignore folders like vendor in php and node_modules?
Can mini-fied code be detected and omitted when a flag is present? (mostly libraries, not written by the code authors, or build artifacts)
How should things like md, txt and html be calculated for cost?, particularly in the presence of generators?
Can there be a estimate for cost of maintenance?
should cost consider complexity of programming languages? it's not the same to have 10 lines of css than 10 lines of ML code than 10 lines of template meta-programming multi-threaded hardened c++ server code, or 10 lines of glsl shader code, or maybe 10 lines of a language like Haskell might be counted in complexity as the same as 10 lines of BASIC, does that even make sense? can there be a parameter where one can indicate the avg cost for each developer?, I know estimates aren't perfect, but I'd like to know this.
how is code that generates other code being estimated for cost? is that more complex?
what about self-modifying code?
do generics impact the estimate cost? what about things like macros? can configuration files be auto-detected as such?
I leave these ideas here in the hopes it would spark an interesting conversation :)
localhost:scc-master b$ ~/scc .
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
Java 21 3725 2345 620 760 521
Go 19 5452 4359 454 639 673
Python 8 343 306 19 18 29
Markdown 5 614 498 0 116 0
Powershell 2 240 46 159 35 8
Plain Text 2 31 24 0 7 0
License 2 45 37 0 8 0
ignore 2 2 2 0 0 0
Report Definition L… 1 0 0 0 0 0
Futhark 1 29 16 10 3 2
Alloy 1 50 4 40 6 0
Gherkin Specificati… 1 0 0 0 0 0
gitignore 1 33 19 7 7 0
JSON 1 6852 6851 0 1 0
nuspec 1 22 22 0 0 0
Alchemist 1 20 20 0 0 55
Wren 1 188 131 35 22 8
Luna 1 23 17 1 5 0
Q# 1 31 23 2 6 5
Bitbucket Pipeline 1 23 22 0 1 0
Macromedia eXtensib… 1 0 0 0 0 0
TOML 1 38 9 25 4 0
Varnish Configurati… 1 0 0 0 0 0
JavaServer Pages 1 0 0 0 0 0
Extensible Styleshe… 1 0 0 0 0 0
Docker ignore 1 3 2 1 0 0
Flow9 1 21 12 6 3 5
Bosque 1 179 139 8 32 1
Freemarker Template 1 0 0 0 0 0
Coq 1 168 141 9 18 5
SystemVerilog 1 79 51 21 7 5
Monkey C 1 74 62 0 12 12
YAML 1 20 19 0 1 0
Shell 1 294 252 8 34 36
V 1 73 35 30 8 3
───────────────────────────────────────────────────────────────────────────────
Total 88 18672 15464 1455 1753 1368
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $479,052
Estimated Schedule Effort 11.599424 months
Estimated People Required 4.892170
───────────────────────────────────────────────────────────────────────────────
The big takeaway from https://boyter.org/posts/sloc-cloc-code/ is that disabling the garbage collector speeds processing up by a factor of two. If it were possible to eliminate the GC pressure that would be a free performance gain.
Some ideas.
A short term gain might be to just turn off GC until a threshold of files has been identified in the walker. Then turn it on.
Describe the bug
Count is broken when there is a line in C# file with verbatim string in it like this:
private const string BasePath = @"a:\";
.
To Reproduce
scc
Actual behavior
Language Files Lines Code Comments Blanks Complexity
C# 1 20 20 0 0 0
Expected behavior
Language Files Lines Code Comments Blanks Complexity
C# 1 20 14 3 3 0
Tested on
Install by go get -u github.com/boyter/scc/
.
But output zsh: command not found: scc
when use scc
Desktop (please complete the following information):
The help message produced by scc
is somewhat confusing and hard to read.
The help text is currently 170 columns wide. It could benefit from line wrapping, ideally automatic based on terminal width, but I understand if that's out of scope.
Current:
--wide, -w Set to check produce more output such as complexity and code vs complexity ranking. Same as setting format to wide
Wrapping for 100 columns:
--wide, -w Set to check produce more output such as complexity and
code vs complexity ranking. Same as setting format to wide.
In addition, many of the help messages are phrased awkwardly, which makes the width issue worse.
For example, --files
has the description "Set to specify you want to see the output for every file" which could be written more concisely as "Display output for every file".
Since the default output is meant to be human-readable, would it make sense to add thousands separators to make the output more easily readable?
I would make a PR but I'm a Go noob and not actually sure of best practice.
This is a great tool, but it took me a really long time to work out how to get it running.
Would it be possible to add instructions to install to the README file, or at least link to https://github.com/boyter/scc/releases somewhere.
$ scc --bad-flag .
Error: unknown flag: --bad-flag
Usage:
scc [flags]
Flags:
--avg-wage int average wage value used for basic COCOMO calculation (default 56286)
--binary disable binary file detection
--by-file display output for every file
--cocomo remove COCOMO calculation output
--debug enable debug output
--exclude-dir strings directories to exclude (default [.git,.hg,.svn])
--file-gc-count int number of files to parse before turning the GC on (default 10000)
-f, --format string set output format [tabular, wide, json, csv] (default "tabular")
-h, --help help for scc
-i, --include-ext strings limit to file extensions [comma separated list: e.g. go,java,js]
-l, --languages print supported languages and extensions
-c, --no-complexity skip calculation of code complexity
-d, --no-duplicates remove duplicate files from stats and output
-M, --not-match string ignore files and directories matching regular expression
-o, --output string output filename (default stdout)
-s, --sort string column to sort by [files, name, lines, blanks, code, comments, complexity] (default "files")
-t, --trace enable trace output. Not recommended when processing multiple files
-v, --verbose verbose output
--version version for scc
-w, --wide wider output with additional statistics (implies --complexity)
$ echo $?
0
Describe the bug
When first line in C# file contains single-line comment (starts with //
), it is counted as code.
To Reproduce
Expected behavior
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
C# 1 14 11 2 1 0
───────────────────────────────────────────────────────────────────────────────
Total 1 14 11 2 1 0
───────────────────────────────────────────────────────────────────────────────
Actual behavior
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
C# 1 14 12 1 1 0
───────────────────────────────────────────────────────────────────────────────
Total 1 14 12 1 1 0
───────────────────────────────────────────────────────────────────────────────
Desktop
Currently it's detected as a plain text.
Related:
Line 87 in 012df08
No mention I noticed from the example that it includes the root, and not clear why you might want to potentially blacklist files outside the root?
$ scc
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks Complexity
-------------------------------------------------------------------------------
JavaScript 67 105600 71931 17008 16661 18812
Python 66 18236 14135 797 3304 2572
HTML 46 27966 27239 40 687 0
SVG 21 581 581 0 0 0
CSS 21 19368 15996 535 2837 0
Plain Text 14 880 716 0 164 0
SQL 10 647 233 367 47 0
Perl 4 32511 26928 3394 2189 4163
Shell 4 43 31 7 5 2
Java 3 2828 1883 633 312 366
JSON 2 9359 9359 0 0 0
C++ 2 2389 1642 311 436 84
C# 2 40 35 1 4 4
F# 2 101 64 2 35 5
Forth 2 33 23 2 8 3
Markdown 2 12 11 0 1 0
PHP 1 2 2 0 0 0
gitignore 1 57 39 13 5 0
Varnish Configuration 1 50 38 0 12 0
Ruby 1 22 3 18 1 0
License 1 20 16 0 4 0
Ruby HTML 1 267 243 0 24 20
C Header 1 70 20 40 10 0
-------------------------------------------------------------------------------
Total 275 221082 171168 23168 26746 26031
-------------------------------------------------------------------------------
Add in Coveralls https://coveralls.io/github/boyter/scc so now is the time to improve that number. Want at least 80%
As the title says.
Project: https://github.com/vespa-engine/vespa
Commit: 389801098797ab37c7bc4ac5a3888ef4d92214e7
CMake files marked as Plain Text
# scc --version
scc version 1.1.0
# scc
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks Complexity
-------------------------------------------------------------------------------
Java 7264 776647 577947 84844 113856 47825
C++ 3160 568874 479707 16565 72602 51343
C Header 2802 218981 136097 44848 38036 4763
Plain Text 1208 288657 288021 0 636 0
XML 620 156449 155398 204 847 0
Module-Definition 252 7498 5992 0 1506 626
Shell 189 9843 7441 1077 1325 1289
JSON 135 9918 9904 0 14 0
C++ Header 133 20360 17209 810 2341 2651
Scala 59 5242 3811 303 1128 220
Markdown 49 843 607 0 236 0
Perl 49 7547 6076 627 844 926
HTML 18 2171 1950 11 210 0
Autoconf 12 131 107 19 5 6
Ruby 9 342 294 9 39 18
Python 9 1118 815 97 206 191
C 7 1881 1427 179 275 141
Emacs Lisp 4 2752 2118 403 231 93
CMake 3 676 473 79 124 58
Makefile 2 41 36 2 3 0
YAML 1 27 19 1 7 0
Dockerfile 1 16 10 2 4 3
MSBuild 1 6 6 0 0 0
Protocol Buffers 1 464 143 255 66 0
-------------------------------------------------------------------------------
Total 15988 2080484 1695608 150335 234541 110153
-------------------------------------------------------------------------------
Estimated Cost to Develop $66,433,488
Estimated Schedule Effort 75.578429 months
Estimated People Required 104.122323
-------------------------------------------------------------------------------
# tokei --version
tokei 7.0.3 compiled without serialization formats.
# tokei -s files
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Java 7264 795587 578434 103023 114130
C++ 3160 570774 481222 16697 72855
C Header 2802 228614 136351 53756 38507
CMake 1018 14243 12801 1127 315
XML 620 157314 155418 985 911
Module-Definition 252 7499 5993 0 1506
Shell 203 11145 8490 1155 1500
Plain Text 193 275090 275090 0 0
JSON 135 9918 9918 0 0
C++ Header 133 20455 17210 902 2343
Scala 59 5313 3817 365 1131
Perl 52 8409 6733 711 965
Markdown 49 843 843 0 0
HTML 18 2190 1950 29 211
Autoconf 12 131 107 19 5
Python 9 1118 817 95 206
Ruby 9 342 294 9 39
C 7 1918 1432 198 288
Emacs Lisp 4 2752 2118 403 231
Makefile 2 41 36 2 3
Dockerfile 1 16 10 2 4
Protocol Buffers 1 464 143 255 66
-------------------------------------------------------------------------------
Total 16003 2114176 1699227 179733 235216
-------------------------------------------------------------------------------
in the same vein as the hombrew ticket, how about a package on chocolatey?
Describe the bug
Verilog files are being identified as V.
To Reproduce
Clone https://github.com/seldridge/verilog.git
Run scc over the folder ./src
inside it
Observe the output where V language is identified
$ scc
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
SystemVerilog 7 598 383 171 44 66
V 6 965 771 143 51 36
───────────────────────────────────────────────────────────────────────────────
Total 13 1563 1154 314 95 102
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $31,398
Estimated Schedule Effort 4.118292 months
Estimated People Required 0.903127
───────────────────────────────────────────────────────────────────────────────
Expected behavior
All the files in this directory should be identified as Verilog.
Desktop (please complete the following information):
/* 8 lines 5 code 1 comments 2 blanks */
void main() {
auto x = 5; /+ a /+ nested +/ comment /* +/
writefln("hello");
auto y = 4; // */
}
Note that in the above /+
allows nested comments but that */ can be inside the different one. Currently scc is unable to deal with this.
macOS: Sierra (10.12.6)
Get this error trying to scc
one of our (large) Java application directories. Using verbose mode indicates 1025 WARN
-ings prior to the runtime failure. Command line:
~/code/scc -v .
(no other options)
stack trace attached:
scc-stack.txt
Languages like Mako, Jinja etc... have the ability to break into code. However scc
is unaware of this and considers the whole thing to be code. Need to have some sort of system that allows toggling between code and comment mode, IE invert the usual case of expecting code that can go into a comment and reverse it.
A quick hack to resolve this might be to have a flag that starts the code in comment mode by default, but that when this happens continue to do the complexity checks anyway to find the template conditionals.
Describe the bug
When running scc
with -d
option sometimes the counts of files changes.
To Reproduce
Used via command line with -d
option.
counting-tests>scc.exe -d
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
Java 52 6665 2439 3411 815 95
XML 11 651 519 56 76 0
Plain Text 5 128 91 0 37 0
XML Schema 2 958 906 0 52 0
gitignore 1 47 26 10 11 0
Properties File 1 5 3 2 0 0
───────────────────────────────────────────────────────────────────────────────
Total 72 8454 3984 3479 991 95
────────────────────────────────────────────────────────────
// !!!!!!!!!!!!!!
// NOW HERE the number of java files goes down by 4
// and the number of Properties File is 2 instead of 1
!! !!!!!!!!!!!!!!
counting-tests>scc.exe -d
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
Java 48 6201 2269 3172 760 91
XML 11 651 519 56 76 0
Plain Text 5 128 91 0 37 0
Properties File 2 12 8 4 0 0
XML Schema 2 958 906 0 52 0
gitignore 1 47 26 10 11 0
───────────────────────────────────────────────────────────────────────────────
Total 69 7997 3819 3242 936 91
────────────────────────────────────────────────────────────
Expected behavior
The number of Java and Properties files should not change between runs with -d
option. Note that --by-file
should produce different results as it depends on which file is processed first which one is marked as a duplicate.
Desktop (please complete the following information):
Hi,
I just go get
scc and try it to count on my project. I was surprised with line:
Robot Framework 1 54580 53988 0 592 0
Actually I have binary with the name robot
and scc counts this binary as a .robot
extension. When I renamed my binary to robot1
, the line disappeared. Your program looks fine, but you should count only on extensions, not on names which duplicate extension name.
P.S.: Counting adoc
(asciidoc) files is almost same like counting markdown files. We use them for documentation. It is pity adoc
is not in the default configuration.
Filename: test.d.ts
Should identify as: TS Typings
Use the same definitions as TypeScript
Requires a change to the way extensions are calculated. Needs to split on the first . and check for d.ts then fallback to .ts.
There seems to be a mix of CRLF and LF line endings when checked out. Perhaps a .gitattributes file should be in place?
https://help.github.com/articles/dealing-with-line-endings/
CRLF:
$ grep -lr $'\r' *
CODE_OF_CONDUCT.md
CONTRIBUTING.md
examples/speedwalk/main.go
examples/godirwalk/main.go
examples/mmap/main_test.go
examples/mmap/main.go
examples/complexity/complexity.java
examples/create_folders_with_files.py
examples/walk/main.go
examples/stringconcat/main_test.go
examples/fileread/100k
examples/fileread/main_test.go
examples/fileread/10k
examples/fileread/main.go
examples/fileread/fileread
examples/fileread/1000k
examples/fileread/linuxaverage
examples/cwalk/main.go
examples/nativewalk/main.go
.git/objects/pack/pack-3c13ce3ebdc90d9918848fd20574e2bf9ed60025.idx
.git/objects/pack/pack-3c13ce3ebdc90d9918848fd20574e2bf9ed60025.pack
.git/index
languages.json
processor/helpers.go
processor/helpers_test.go
processor/formatters_test.go
processor/cocomo_test.go
processor/file.go
processor/structs_test.go
processor/file_test.go
processor/processor_test.go
processor/cocomo.go
UNLICENSE
LF
$ grep -Lr $'\r' *
assets/database_languages2.json
assets/merge.py
assets/database_languages.json
examples/onenewline.py
examples/oneline.py
examples/twonewline.py
examples/threenewline.py
examples/twolines.py
examples/nolines.py
examples/fileread/textfile.json
.git/logs/HEAD
.git/logs/refs/heads/master
.git/logs/refs/remotes/origin/HEAD
.git/hooks/pre-receive.sample
.git/hooks/pre-rebase.sample
.git/hooks/update.sample
.git/hooks/pre-applypatch.sample
.git/hooks/post-update.sample
.git/hooks/pre-commit.sample
.git/hooks/pre-push.sample
.git/hooks/commit-msg.sample
.git/hooks/fsmonitor-watchman.sample
.git/hooks/prepare-commit-msg.sample
.git/hooks/applypatch-msg.sample
.git/description
.git/packed-refs
.git/info/exclude
.git/HEAD
.git/refs/heads/master
.git/refs/remotes/origin/HEAD
.git/config
.gitignore
Gopkg.lock
Gopkg.toml
LICENSE
main.go
processor/workers.go
processor/processor.go
processor/workers_test.go
processor/structs.go
processor/formatters.go
processor/constants.go
README.md
scripts/include.go
.travis.yml
vendor/github.com/monochromegane/go-gitignore/match.go
vendor/github.com/monochromegane/go-gitignore/util.go
vendor/github.com/monochromegane/go-gitignore/pattern.go
vendor/github.com/monochromegane/go-gitignore/index_scan_patterns.go
vendor/github.com/monochromegane/go-gitignore/gitignore.go
vendor/github.com/monochromegane/go-gitignore/patterns.go
vendor/github.com/monochromegane/go-gitignore/.travis.yml
vendor/github.com/monochromegane/go-gitignore/README.md
vendor/github.com/monochromegane/go-gitignore/LICENSE
vendor/github.com/monochromegane/go-gitignore/initial_holder.go
vendor/github.com/monochromegane/go-gitignore/depth_holder.go
vendor/github.com/monochromegane/go-gitignore/full_scan_patterns.go
vendor/github.com/pkg/errors/stack.go
vendor/github.com/pkg/errors/appveyor.yml
vendor/github.com/pkg/errors/errors.go
vendor/github.com/pkg/errors/.travis.yml
vendor/github.com/pkg/errors/.gitignore
vendor/github.com/pkg/errors/README.md
vendor/github.com/pkg/errors/LICENSE
vendor/github.com/urfave/cli/flag.go
vendor/github.com/urfave/cli/help.go
vendor/github.com/urfave/cli/flag-types.json
vendor/github.com/urfave/cli/CHANGELOG.md
vendor/github.com/urfave/cli/funcs.go
vendor/github.com/urfave/cli/generate-flag-types
vendor/github.com/urfave/cli/flag_generated.go
vendor/github.com/urfave/cli/category.go
vendor/github.com/urfave/cli/appveyor.yml
vendor/github.com/urfave/cli/runtests
vendor/github.com/urfave/cli/app.go
vendor/github.com/urfave/cli/command.go
vendor/github.com/urfave/cli/errors.go
vendor/github.com/urfave/cli/.travis.yml
vendor/github.com/urfave/cli/cli.go
vendor/github.com/urfave/cli/.gitignore
vendor/github.com/urfave/cli/README.md
vendor/github.com/urfave/cli/LICENSE
vendor/github.com/urfave/cli/context.go
vendor/github.com/urfave/cli/.flake8
vendor/github.com/edsrzf/mmap-go/mmap_unix.go
vendor/github.com/edsrzf/mmap-go/mmap_windows.go
vendor/github.com/edsrzf/mmap-go/.gitignore
vendor/github.com/edsrzf/mmap-go/README.md
vendor/github.com/edsrzf/mmap-go/msync_netbsd.go
vendor/github.com/edsrzf/mmap-go/msync_unix.go
vendor/github.com/edsrzf/mmap-go/LICENSE
vendor/github.com/edsrzf/mmap-go/mmap.go
vendor/github.com/iafan/cwalk/cwalk.go
vendor/github.com/iafan/cwalk/MIT-LICENSE.txt
vendor/github.com/iafan/cwalk/.gitignore
vendor/github.com/iafan/cwalk/README.md
vendor/github.com/MichaelTJones/walk/symlink_windows.go
vendor/github.com/MichaelTJones/walk/path_windows.go
vendor/github.com/MichaelTJones/walk/path_plan9.go
vendor/github.com/MichaelTJones/walk/path_unix.go
vendor/github.com/MichaelTJones/walk/walk.go
vendor/github.com/MichaelTJones/walk/README.md
vendor/github.com/MichaelTJones/walk/symlink.go
vendor/github.com/karrick/godirwalk/withoutNamlen.go
vendor/github.com/karrick/godirwalk/readdir_unix.go
vendor/github.com/karrick/godirwalk/dirent_fileno.go
vendor/github.com/karrick/godirwalk/readdir_windows.go
vendor/github.com/karrick/godirwalk/doc.go
vendor/github.com/karrick/godirwalk/withNamlen.go
vendor/github.com/karrick/godirwalk/walk.go
vendor/github.com/karrick/godirwalk/go.mod
vendor/github.com/karrick/godirwalk/.gitignore
vendor/github.com/karrick/godirwalk/README.md
vendor/github.com/karrick/godirwalk/LICENSE
vendor/github.com/karrick/godirwalk/readdir.go
vendor/github.com/karrick/godirwalk/dirent_ino.go
Every time I run scc on the same codebase on my Macbook, I get completely different results. Even the file count changes every time I run it!
It would be great if code could be updated to be able to use it as a library
I got a panic when running scc on the command line in Windows 10.
The command was:
scc */*.cpp
when run on a directory with no sub-directories (I forgot which directory I was in and ran this by accident). The same command works fine when there are sub-directories to enter.
The error message was:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x10 pc=0x52ad92]
goroutine 4 [running]:
github.com/boyter/scc/processor.walkDirectoryParallel(0x1140a080, 0x7, 0x11482140)
/home/bboyter/Go/src/github.com/boyter/scc/processor/file.go:84 +0xf2
github.com/boyter/scc/processor.Process.func1.1(0x1140a080, 0x7, 0x11482140, 0x1140a070)
/home/bboyter/Go/src/github.com/boyter/scc/processor/processor.go:344 +0x31
created by github.com/boyter/scc/processor.Process.func1
/home/bboyter/Go/src/github.com/boyter/scc/processor/processor.go:343 +0xa5
Not a big issue, since the glob doesn't match any files anyway, but an error message would be nicer than a panic.
scc -v .
works fine
scc . -v
does not work (options like -v are ignored)
Its used by both ag and rg and should be included. Would be a nice way to add vendor as an exclusion for example.
# bboyter @ SurfaceBook2 in ~/Go/src/github.com/boyter/scc/examples/long on git:master x [9:18:03]
$ scc
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
7 0 0 0 0 0
───────────────────────────────────────────────────────────────────────────────
Total 7 0 0 0 0 0
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $0
Estimated Schedule Effort 0.000000 months
Estimated People Required NaN
───────────────────────────────────────────────────────────────────────────────
Not sure what is going on here. Need to investigate before release.
Building via go build
, receive the following errors:
main.go:4:2: cannot find package "github.com/boyter/scc/processor" **in** any of: /usr/local/Cellar/go/1.10.2/libexec/src/github.com/boyter/scc/processor (from $GOROOT) /Users/myuser/go/src/github.com/boyter/scc/processor (from $GOPATH) main.go:5:2: cannot find package "github.com/urfave/cli" **in** any of: /usr/local/Cellar/go/1.10.2/libexec/src/github.com/urfave/cli (from $GOROOT) /Users/myuser/go/src/github.com/urfave/cli (from $GOPATH)
Problem is fixed by installing necessary dependencies (as indicated above) with:
go get github.com/boyter/scc/processor github.com/urfave/cli
Build then works. I'm considering this a workaround and only added this issue as documentation for others that may (will?) run into this.
OS: macOS Sierra (10.12.6)
go version: go1.10.2 darwin/amd64
PS: new to Go, bear with me if this is implicit.
Have a prototype running here https://github.com/boyter/really-cheap-chatbot
Implementation lives here https://github.com/boyter/scc-lambda
Want to have this available for anyone to just add so they get their choice of count etc...
Describe the bug
In some cases blank lines are not counted correctly in Java files.
I've simplified the example somewhat, but could not pinpoint problematic lines.
To Reproduce
Expected behavior
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
Java 1 139 103 16 20 8
Actual behavior
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks Complexity
───────────────────────────────────────────────────────────────────────────────
Java 1 139 119 15 5 8
Desktop
This is becoming more of an issue, especially with the news that V Lang is also going to use v
along with Coq and Verilog vlang/v#6
Annoying because its quite a large refactor to accommodate this. More to the point is how to implement it? One thought is to scan the first 500 bytes or so and look for tokens that indicate one language or another. This is likely to be problematic however.
Might have to have a look at how https://github.com/vmchale/polyglot does it and copy whatever it is doing.
Things to keep in mind. Need to do this for every file that has the extension up to some point. As such it needs to be fast. One possible thing to do here is after checking some amount of files if all are determined to be Coq perhaps flip over to just assuming that will be the case for everything else from that point on.
I tried scc 2.2.0 on Windows, on a python file, and it appears that Python docstrings are counted as code instead of comments.
'''This is a module docstring'''
class C:
'''
This is a class docstring
'''
def f():
"""This is a function docstring.
simple quotes and double quotes are equivalent
"""
pass
lines: 12
code: 10
comments: 0
blanks: 2
This should be:
lines: 12
code: 3
comments: 7
blanks:2
See https://github.com/pinpt/ripsrc/releases/tag/3.1.0
This should never have happened. Refactor so that this is only set via command line usage and not though API.
Also a big apology to @jhaynie for this.
I've been looking into your repo and would like to see if you might be interested in turning this into an API -- such that you could use it as a library in addition to a command line program.
Looking through your code, it seems like we could generalize the FileJob into a more generic type or interface and make countStats
public and it could easily then be called as a library.
My use case is that I'd like to be able to feed a reader into countStats
so that I can dynamically pipe a source file (in my case from memory) into your API and have it return me the results.
Is this something you'd be interested discussing further?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.