# How to analyse the complexity of a Julia project?

**URL:** <https://discourse.julialang.org/t/how-to-analyse-the-complexity-of-a-julia-project/101678>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 16, 2023, 5:48pm UTC](https://discourse.julialang.org/t/how-to-analyse-the-complexity-of-a-julia-project/101678 "2023-07-16T17:48:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 16, 2023, 5:48pm UTC](https://discourse.julialang.org/t/how-to-analyse-the-complexity-of-a-julia-project/101678/1 "2023-07-16T17:48:29Z")

</div>

In the past I used sloccount, but it does not even know of Julia, it thinks it is lisp (ok, not totally wrong).

I would like to know:

- number of source code files
- lines of source code
- dito without comments and blank lines
- number modules and functions
- average and max number of lines per function; this might give  
a hint where refactoring is needed
- code for tests should be counted separately from code in the src folder
- in addition the lines in the .md files should be counted separately
- files in .CondaPkg should be ignored

Any idea which tool I could use?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 16, 2023, 6:12pm UTC](https://discourse.julialang.org/t/how-to-analyse-the-complexity-of-a-julia-project/101678/2 "2023-07-16T18:12:12Z")

</div>

> [@ufechner7](#):
>
> - number of source code files
> - lines of source code
> - dito without comments and blank lines

> **[GitHub - XAMPPRocky/tokei: Count your code, quickly.](https://github.com/XAMPPRocky/tokei)**
>
> Count your code, quickly. Contribute to XAMPPRocky/tokei development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [July 16, 2023, 6:36pm UTC](https://discourse.julialang.org/t/how-to-analyse-the-complexity-of-a-julia-project/101678/3 "2023-07-16T18:36:55Z")

</div>

> **[GitHub - JuliaEcosystem/PackageAnalyzer.jl](https://github.com/JuliaEcosystem/PackageAnalyzer.jl)**
>
> Contribute to JuliaEcosystem/PackageAnalyzer.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 16, 2023, 7:11pm UTC](https://discourse.julialang.org/t/how-to-analyse-the-complexity-of-a-julia-project/101678/4 "2023-07-16T19:11:03Z")

</div>

> [@ufechner7](#):
>
> In the past I used sloccount, but it does not even know of Julia, it thinks it is lisp (ok, not totally wrong).

[GitHub - boyter/scc: Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go](https://github.com/boyter/scc) has Julia-specific rules.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 16, 2023, 8:05pm UTC](https://discourse.julialang.org/t/how-to-analyse-the-complexity-of-a-julia-project/101678/5 "2023-07-16T20:05:54Z")

</div>

`scc` with the parameter `-x toml` is already pretty nice:

```julia
ufechner@tuxedi:~/repos/WindTurbines$ scc -x toml .
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Blanks Comments Code Complexity
───────────────────────────────────────────────────────────────────────────────
Julia 32 2190 240 146 1804 120
YAML 5 213 4 1 208 0
BASH 2 44 8 2 34 9
Markdown 2 288 56 0 232 0
Plain Text 1 20 4 0 16 0
gitignore 1 14 0 0 14 0
───────────────────────────────────────────────────────────────────────────────
Total 43 2769 312 149 2308 129
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $65.011
Estimated Schedule Effort (organic) 4,87 months
Estimated People Required (organic) 1,19
───────────────────────────────────────────────────────────────────────────────
Processed 101294 bytes, 0.101 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────

```

Without this parameter it counts the pretty long Manifest.toml file which I did not write myself…

I wrote this code in two months, so I guess my performance is good…
