Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for package extensions in show method #94

Merged

Conversation

hyrodium
Copy link
Contributor

This PR adds support for package extensions by counting lines in the ext directory.

Before this PR

julia> using PackageAnalyzer

julia> analyze("https://github.com/hyrodium/BasicBSpline.jl")
PackageV1 BasicBSpline:
  * repo: https://github.com/hyrodium/BasicBSpline.jl
  * uuid: 4c5d9882-2acf-4ea4-9e48-968fd4518195
  * version: missing
  * is reachable: true
  * tree hash: 9b4f65180a415c9a61975b1dafaee2cdd07011d1
  * Julia code in `src`: 2444 lines
  * Julia code in `test`: 1828 lines (42.8% of `test` + `src`)
  * documentation in `docs`: 1237 lines (33.6% of `docs` + `src`)
  * documentation in README & docstrings: 348 lines (12.5% of README + `src`)
  * has license(s) in file: MIT
    * filename: LICENSE
    * OSI approved: true
  * has `docs/make.jl`: true
  * has `test/runtests.jl`: true
  * has continuous integration: true
    * GitHub Actions

After this PR

julia> using PackageAnalyzer

julia> analyze("https://github.com/hyrodium/BasicBSpline.jl")
PackageV1 BasicBSpline:
  * repo: https://github.com/hyrodium/BasicBSpline.jl
  * uuid: 4c5d9882-2acf-4ea4-9e48-968fd4518195
  * version: missing
  * is reachable: true
  * tree hash: 9b4f65180a415c9a61975b1dafaee2cdd07011d1
  * Julia code in `src`: 2444 lines
  * Julia code in `ext`: 161 lines (3.6% of `test` + `src` + `ext`)
  * Julia code in `test`: 1828 lines (41.2% of `test` + `src` + `ext`)
  * documentation in `docs`: 1237 lines (32.2% of `docs` + `src` + `ext`)
  * documentation in README & docstrings: 348 lines (12.5% of README + `src`)
  * has license(s) in file: MIT
    * filename: LICENSE
    * OSI approved: true
  * has `docs/make.jl`: true
  * has `test/runtests.jl`: true
  * has continuous integration: true
    * GitHub Actions

Comment on lines +197 to +199
* Julia code in `ext`: $(l_ext) lines ($(p_ext)% of `test` + `src` + `ext`)
* Julia code in `test`: $(l_test) lines ($(p_test)% of `test` + `src` + `ext`)
* documentation in `docs`: $(l_docs) lines ($(p_docs)% of `docs` + `src` + `ext`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure adding ext to the denominator was the best thing to do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I'm not sure either. I think it is probably OK though, treating it similarly to source code, and expecting a package with a lot of extension code to need more documentation than one without it.

@ericphanson ericphanson changed the title Add support for package extensions Add support for package extensions in show method Oct 16, 2023
@hyrodium
Copy link
Contributor Author

I think the CI failure on Julia 1.6 - windows-latest is not related to this PR.

Copy link
Member

@giordano giordano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I suggested a change to reduce duplication

Comment on lines +191 to +193
p_ext = @sprintf("%.1f", 100 * l_ext / (l_test + l_src + l_ext))
p_test = @sprintf("%.1f", 100 * l_test / (l_test + l_src + l_ext))
p_docs = @sprintf("%.1f", 100 * l_docs / (l_docs + l_src + l_ext))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have

Suggested change
p_ext = @sprintf("%.1f", 100 * l_ext / (l_test + l_src + l_ext))
p_test = @sprintf("%.1f", 100 * l_test / (l_test + l_src + l_ext))
p_docs = @sprintf("%.1f", 100 * l_docs / (l_docs + l_src + l_ext))
l_total = l_test + l_src + l_ext
p_ext = @sprintf("%.1f", 100 * l_ext / l_total)
p_test = @sprintf("%.1f", 100 * l_test / l_total)
p_docs = @sprintf("%.1f", 100 * l_docs / l_total)

so that we don't have to change the total in multiple places every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to have p_docs is larger than 100? Note that not all denominators are equal. Should we define l_total with

l_total = l_test + l_docs + l_src + l_ext

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, sorry, I missed that one was different

@ericphanson ericphanson merged commit 8189681 into JuliaEcosystem:main Dec 7, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants