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 CodeLimit workflow #4220

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

robvanderleek
Copy link

@robvanderleek robvanderleek commented Dec 24, 2024

Overview

Thanks for this wonderful project.
Are you open to include a simple code quality check in the automated build system?
I'm developing an open source tool called CodeLimit that monitors function length.
Still in active development, looking for any kind of feedback from the community.
The generated report for this codebase is attached below.

CodeLimit Report

Overview

Language Files Functions Lines of Code
Java 889 4768 25769 23 0
JavaScript 2 22 35 0 0
Totals 891 4790 25804 23 0

Summary

Easy / Verbose Hard-to-maintain ⚠ Unmaintainable ⛌
96% 4% 0%

✅ 96% of the functions are maintainable, no refactoring necessary.

Findings

Function Length File
assertLinesMatchWithFastForward 54 junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertLinesMatch.java
resolve 48 junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolution.java
provideArguments 48 junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptyArgumentsProvider.java
orderChildrenTestDescriptors 47 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractOrderingVisitor.java
walk 46 junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java
nullSafeToString 42 junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java
isWideningConversion 42 junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java
assertArrayElementsEqual 41 junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertArrayEquals.java
toStream 41 junit-platform-commons/src/main/java/org/junit/platform/commons/util/CollectionUtils.java
addTestSource 41 junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java

13 more rows


I hereby agree to the terms of the JUnit Contributor License Agreement.


@marcphilipp
Copy link
Member

Thanks for the initiative and the PR! We'll discuss whether to adopt this in our next team call.

apply 61 junit-platform-commons/src/main/java/org/junit/platform/commons/function/Try.java

@robvanderleek That is not actually a function body. Something seems to throw off your parser. 🤔

@marcphilipp
Copy link
Member

Moreover, please rebase since I've improved SuiteLauncherDiscoveryRequestBuilder (based on your findings) on main in the meantime. 🙂

@robvanderleek robvanderleek force-pushed the robvanderleek-add-codelimit-workflow branch from 2ae2ded to b0b0dd4 Compare December 31, 2024 14:06
@robvanderleek
Copy link
Author

Hi @marcphilipp

Thank you for taking the time to look into CodeLimit.
Also, encouraging to see that a finding from the tool could be used to improve the code 🙂

I've rebased the branch and updated the report (when the CodeLimit action runs inside the repository it will update the report automatically).
Now only 1 critical finding remains which is indeed a parse error from the tool, as you mentioned.

I'm currently using a parsing implementation that aims to be performant, robust, versatile (in terms of language support), but also accurate. I will look into the issue.

Again, thanks for the valuable feedback.

@robvanderleek robvanderleek force-pushed the robvanderleek-add-codelimit-workflow branch from b0b0dd4 to 64aab1e Compare January 3, 2025 12:47
@robvanderleek
Copy link
Author

Hi @marcphilipp

I've fixed the parse error and updated the report above.
There are no critical errors left, only 13 findings of methods that could become critical with further growth.

A CodeLimit badge for this repo would now look like this:

image

Background on the meaning of the badge can be found here in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants