Skip to content

Commit

Permalink
we only record the cyclomatic complexity from shellmetrics.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
EtomicBomb committed Nov 21, 2024
1 parent 259c8a3 commit 8637635
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 96 deletions.
6 changes: 3 additions & 3 deletions infrastructure/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
STATIC_OUTPUTS = target/lines_of_code.csv target/nodes_in_scripts.csv target/scripts_to_benchmark.csv target/shellmetrics.csv
STATIC_OUTPUTS = target/lines_of_code.csv target/nodes_in_scripts.csv target/scripts_to_benchmark.csv target/cyclomatic.csv target/shellmetrics.sh

static: $(STATIC_OUTPUTS)

Expand All @@ -21,8 +21,8 @@ target/shellmetrics.sh:
wget --quiet -O $@ https://raw.githubusercontent.com/shellspec/shellmetrics/b3bfff2af6880443112cdbf2ea449440b30ab9b0/shellmetrics
chmod +x $@

target/shellmetrics.csv: get_shellmetrics.py target/shellmetrics.sh
python3 get_shellmetrics.py > $@
target/cyclomatic.csv: get_cyclomatic.py target/shellmetrics.sh
python3 get_cyclomatic.py > $@

dynamic:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
output = check_output([shellmetrics, '--csv', '--shell', 'bash', '--no-color', *all_scripts], text=True)
datas = defaultdict(list)
for line in output.splitlines()[1:]:
file, func, _lineno, lloc, ccn, _lines, _comment, _blank = line.split(',')
file, _func, _lineno, _lloc, ccn, _lines, _comment, _blank = line.split(',')
file = json.loads(file)
file = Path(file).relative_to(root)
datas[file].append((lloc, ccn))
datas[file].append((ccn))

for file, datas in datas.items():
lloc = sum(int(d[0]) for d in datas)
ccn = sum(int(d[1]) for d in datas)
print(file, lloc, ccn, sep=',')
ccn = sum(float(ccn) for ccn, in datas)
print(file, ccn, sep=',')
88 changes: 88 additions & 0 deletions infrastructure/target/cyclomatic.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
covid-mts/scripts/1.sh,1.0
covid-mts/scripts/3.sh,1.0
covid-mts/scripts/4.sh,1.0
covid-mts/scripts/2.sh,1.0
covid-mts/scripts/5.sh,1.0
file-enc/scripts/encrypt_files.sh,3.0
file-enc/scripts/compress_files.sh,2.0
log-analysis/scripts/nginx.sh,3.0
log-analysis/scripts/pcaps.sh,3.0
max-temp/scripts/temp-analytics.sh,1.0
media-conv/scripts/to_mp3.sh,3.0
media-conv/scripts/img_convert.sh,3.0
nlp/scripts/verses_2om_3om_2instances.sh,2.0
nlp/scripts/trigram_rec.sh,3.0
nlp/scripts/uppercase_by_token.sh,2.0
nlp/scripts/words_no_vowels.sh,2.0
nlp/scripts/sort_words_by_folding.sh,2.0
nlp/scripts/syllable_words_2.sh,2.0
nlp/scripts/count_morphs.sh,2.0
nlp/scripts/sort_words_by_num_of_syllables.sh,3.0
nlp/scripts/merge_upper.sh,2.0
nlp/scripts/syllable_words_1.sh,2.0
nlp/scripts/sort_words_by_rhyming.sh,2.0
nlp/scripts/letter_words.sh,2.0
nlp/scripts/sort.sh,2.0
nlp/scripts/count_consonant_seq.sh,2.0
nlp/scripts/count_trigrams.sh,3.0
nlp/scripts/bigrams.sh,3.0
nlp/scripts/count_words.sh,2.0
nlp/scripts/vowel_sequencies_gr_1K.sh,2.0
nlp/scripts/bigrams_appear_twice.sh,3.0
nlp/scripts/compare_exodus_genesis.sh,3.0
nlp/scripts/uppercase_by_type.sh,2.0
nlp/scripts/find_anagrams.sh,3.0
nlp/scripts/count_vowel_seq.sh,2.0
oneliners/scripts/spell.sh,1.0
oneliners/scripts/wf.sh,1.0
oneliners/scripts/bi-gram.aux.sh,4.0
oneliners/scripts/top-n.sh,1.0
oneliners/scripts/sort-sort.sh,1.0
oneliners/scripts/diff.sh,1.0
oneliners/scripts/sort.sh,1.0
oneliners/scripts/bi-grams.sh,1.0
oneliners/scripts/set-diff.sh,1.0
oneliners/scripts/nfa-regex.sh,1.0
sklearn/scripts/run.sh,1.0
riker/scripts/lua/build.sh,1.0
riker/scripts/xz-clang/build.sh,1.0
riker/scripts/vim/build.sh,1.0
riker/scripts/xz/build.sh,1.0
riker/scripts/redis/build.sh,1.0
riker/scripts/sqlite/build.sh,1.0
riker/scripts/memcached/build.sh,2.0
uniq-ips/scripts/run.sh,1.0
unix50/scripts/1.sh,2.0
unix50/scripts/10.sh,2.0
unix50/scripts/16.sh,2.0
unix50/scripts/21.sh,2.0
unix50/scripts/19.sh,2.0
unix50/scripts/6.sh,2.0
unix50/scripts/36.sh,2.0
unix50/scripts/28.sh,2.0
unix50/scripts/12.sh,2.0
unix50/scripts/13.sh,2.0
unix50/scripts/26.sh,2.0
unix50/scripts/31.sh,2.0
unix50/scripts/24.sh,2.0
unix50/scripts/11.sh,2.0
unix50/scripts/23.sh,2.0
unix50/scripts/14.sh,2.0
unix50/scripts/25.sh,2.0
unix50/scripts/7.sh,2.0
unix50/scripts/29.sh,2.0
unix50/scripts/30.sh,2.0
unix50/scripts/3.sh,2.0
unix50/scripts/20.sh,2.0
unix50/scripts/4.sh,2.0
unix50/scripts/34.sh,2.0
unix50/scripts/2.sh,2.0
unix50/scripts/18.sh,2.0
unix50/scripts/33.sh,2.0
unix50/scripts/35.sh,2.0
unix50/scripts/32.sh,2.0
unix50/scripts/15.sh,2.0
unix50/scripts/17.sh,2.0
unix50/scripts/9.sh,2.0
unix50/scripts/8.sh,2.0
unix50/scripts/5.sh,2.0
88 changes: 0 additions & 88 deletions infrastructure/target/shellmetrics.csv

This file was deleted.

0 comments on commit 8637635

Please sign in to comment.