Open gww-certik opened 2 years ago
I had a stab using jq
:
~/Projects/3rd-party/code-maat v0.9.1~134*
❯ tokei --output json | jq -r '.[] | .reports | .[] | [.name, .stats.blanks, .stats.comments, .stats.code] | @csv'
"./src/code_maat/output/filters.clj",2,4,5
"./src/code_maat/analysis/workarounds.clj",2,4,7
"./src/code_maat/analysis/entities.clj",8,4,36
"./src/code_maat/test/data_driven.clj",2,4,25
"./src/code_maat/core.clj",5,4,35
"./src/code_maat/app/app.clj",13,6,85
"./src/code_maat/output/csv.clj",3,5,14
"./src/code_maat/analysis/math.clj",3,4,5
"./src/code_maat/analysis/summary.clj",4,6,18
"./src/code_maat/analysis/authors.clj",8,11,47
"./src/code_maat/parsers/xml.clj",3,4,10
"./src/code_maat/parsers/limitters.clj",6,8,34
"./src/code_maat/parsers/git.clj",4,17,31
"./src/code_maat/analysis/logical_coupling.clj",23,14,145
"./src/code_maat/parsers/hiccup_based_parser.clj",13,17,50
"./src/code_maat/parsers/mercurial.clj",4,20,21
"./src/code_maat/dataset/dataset.clj",9,13,27
"./src/code_maat/parsers/svn.clj",10,11,53
"./test/code_maat/end_to_end/git_live_data_test.clj",3,4,11
"./test/code_maat/end_to_end/mercurial_live_data_test.clj",3,4,11
"./test/code_maat/end_to_end/svn_live_data_test.clj",3,4,14
"./test/code_maat/analysis/entities_test.clj",4,4,21
"./test/code_maat/analysis/authors_test.clj",7,4,26
"./project.clj",1,4,17
"./test/code_maat/parsers/git_test.clj",8,8,38
"./test/code_maat/end_to_end/scenario_tests.clj",18,19,91
"./test/code_maat/parsers/mercurial_test.clj",6,4,27
"./test/code_maat/analysis/logical_coupling_test.clj",15,5,89
"./test/code_maat/parsers/svn_test.clj",7,5,79
"./test/code_maat/analysis/test_data.clj",6,5,20
"./test/code_maat/dataset/dataset_test.clj",5,4,25
"./doc/intro.md",1,2,0
"./README.md",60,87,0
"./test/code_maat/end_to_end/simple_hg.txt",1,5,0
"./test/code_maat/end_to_end/simple_git.txt",1,5,0
"./test/code_maat/end_to_end/empty.xml",0,0,3
"./test/code_maat/end_to_end/simple.xml",0,0,31
Edit: the following is closer, but still with the languages missing from the output. Someone with more time and better jq
-fu might do better still, but it would be good if tokei
could do this by itself.
tokei -s code --output json | jq -r '[ .[].reports[] ] | sort_by(.stats.code) | reverse | .[] | [.name, .stats.blanks, .stats.comments, .stats.code] | @csv'
feature_request: ability to run with
--csv
and--by-file
like in cloc