From 8637635d7b1e328fbec69fa3a1407a4c03fbd0d8 Mon Sep 17 00:00:00 2001 From: EtomicBomb Date: Thu, 21 Nov 2024 17:07:05 -0500 Subject: [PATCH] we only record the cyclomatic complexity from shellmetrics.sh --- infrastructure/Makefile | 6 +- ...{get_shellmetrics.py => get_cyclomatic.py} | 9 +- infrastructure/target/cyclomatic.csv | 88 +++++++++++++++++++ infrastructure/target/shellmetrics.csv | 88 ------------------- 4 files changed, 95 insertions(+), 96 deletions(-) rename infrastructure/{get_shellmetrics.py => get_cyclomatic.py} (78%) create mode 100644 infrastructure/target/cyclomatic.csv delete mode 100644 infrastructure/target/shellmetrics.csv diff --git a/infrastructure/Makefile b/infrastructure/Makefile index 72c7596d..40a65fb4 100644 --- a/infrastructure/Makefile +++ b/infrastructure/Makefile @@ -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) @@ -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: diff --git a/infrastructure/get_shellmetrics.py b/infrastructure/get_cyclomatic.py similarity index 78% rename from infrastructure/get_shellmetrics.py rename to infrastructure/get_cyclomatic.py index b14e5cf0..0b5e292b 100644 --- a/infrastructure/get_shellmetrics.py +++ b/infrastructure/get_cyclomatic.py @@ -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=',') diff --git a/infrastructure/target/cyclomatic.csv b/infrastructure/target/cyclomatic.csv new file mode 100644 index 00000000..d3f6b5c7 --- /dev/null +++ b/infrastructure/target/cyclomatic.csv @@ -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 diff --git a/infrastructure/target/shellmetrics.csv b/infrastructure/target/shellmetrics.csv deleted file mode 100644 index 61b183ad..00000000 --- a/infrastructure/target/shellmetrics.csv +++ /dev/null @@ -1,88 +0,0 @@ -covid-mts/scripts/1.sh,1,1 -covid-mts/scripts/3.sh,1,1 -covid-mts/scripts/4.sh,1,1 -covid-mts/scripts/2.sh,1,1 -covid-mts/scripts/5.sh,1,1 -file-enc/scripts/encrypt_files.sh,7,3 -file-enc/scripts/compress_files.sh,4,2 -log-analysis/scripts/nginx.sh,16,3 -log-analysis/scripts/pcaps.sh,12,3 -max-temp/scripts/temp-analytics.sh,5,1 -media-conv/scripts/to_mp3.sh,7,3 -media-conv/scripts/img_convert.sh,7,3 -nlp/scripts/verses_2om_3om_2instances.sh,9,2 -nlp/scripts/trigram_rec.sh,17,3 -nlp/scripts/uppercase_by_token.sh,7,2 -nlp/scripts/words_no_vowels.sh,7,2 -nlp/scripts/sort_words_by_folding.sh,7,2 -nlp/scripts/syllable_words_2.sh,7,2 -nlp/scripts/count_morphs.sh,7,2 -nlp/scripts/sort_words_by_num_of_syllables.sh,15,3 -nlp/scripts/merge_upper.sh,7,2 -nlp/scripts/syllable_words_1.sh,7,2 -nlp/scripts/sort_words_by_rhyming.sh,7,2 -nlp/scripts/letter_words.sh,8,2 -nlp/scripts/sort.sh,7,2 -nlp/scripts/count_consonant_seq.sh,7,2 -nlp/scripts/count_trigrams.sh,16,3 -nlp/scripts/bigrams.sh,15,3 -nlp/scripts/count_words.sh,7,2 -nlp/scripts/vowel_sequencies_gr_1K.sh,7,2 -nlp/scripts/bigrams_appear_twice.sh,16,3 -nlp/scripts/compare_exodus_genesis.sh,17,3 -nlp/scripts/uppercase_by_type.sh,7,2 -nlp/scripts/find_anagrams.sh,15,3 -nlp/scripts/count_vowel_seq.sh,7,2 -oneliners/scripts/spell.sh,2,1 -oneliners/scripts/wf.sh,1,1 -oneliners/scripts/bi-gram.aux.sh,43,4 -oneliners/scripts/top-n.sh,1,1 -oneliners/scripts/sort-sort.sh,1,1 -oneliners/scripts/diff.sh,3,1 -oneliners/scripts/sort.sh,1,1 -oneliners/scripts/bi-grams.sh,2,1 -oneliners/scripts/set-diff.sh,3,1 -oneliners/scripts/nfa-regex.sh,1,1 -sklearn/scripts/run.sh,49,1 -riker/scripts/lua/build.sh,8,1 -riker/scripts/xz-clang/build.sh,18,1 -riker/scripts/vim/build.sh,22,1 -riker/scripts/xz/build.sh,18,1 -riker/scripts/redis/build.sh,19,1 -riker/scripts/sqlite/build.sh,34,1 -riker/scripts/memcached/build.sh,11,2 -uniq-ips/scripts/run.sh,1,1 -unix50/scripts/1.sh,2,2 -unix50/scripts/10.sh,2,2 -unix50/scripts/16.sh,2,2 -unix50/scripts/21.sh,2,2 -unix50/scripts/19.sh,2,2 -unix50/scripts/6.sh,2,2 -unix50/scripts/36.sh,2,2 -unix50/scripts/28.sh,2,2 -unix50/scripts/12.sh,2,2 -unix50/scripts/13.sh,2,2 -unix50/scripts/26.sh,2,2 -unix50/scripts/31.sh,2,2 -unix50/scripts/24.sh,2,2 -unix50/scripts/11.sh,2,2 -unix50/scripts/23.sh,2,2 -unix50/scripts/14.sh,2,2 -unix50/scripts/25.sh,2,2 -unix50/scripts/7.sh,2,2 -unix50/scripts/29.sh,2,2 -unix50/scripts/30.sh,2,2 -unix50/scripts/3.sh,2,2 -unix50/scripts/20.sh,2,2 -unix50/scripts/4.sh,2,2 -unix50/scripts/34.sh,2,2 -unix50/scripts/2.sh,2,2 -unix50/scripts/18.sh,2,2 -unix50/scripts/33.sh,2,2 -unix50/scripts/35.sh,2,2 -unix50/scripts/32.sh,2,2 -unix50/scripts/15.sh,2,2 -unix50/scripts/17.sh,2,2 -unix50/scripts/9.sh,2,2 -unix50/scripts/8.sh,2,2 -unix50/scripts/5.sh,2,2