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

Improve UnnamedParameterUse message (change CALL_EXPRESSION to actual function name) #6681

Merged
merged 4 commits into from Dec 5, 2023

Conversation

TWiStErRob
Copy link
Member

I got some reports from this rule while testing detekt 2 upgrade:

....kt:49:9: CALL_EXPRESSION uses unnamed parameters. Consider using named parameters as they make usage of function more safe [UnnamedParameterUse]
....kt:54:12: CALL_EXPRESSION uses unnamed parameters. Consider using named parameters as they make usage of function more safe [UnnamedParameterUse]
....kt:59:9: CALL_EXPRESSION uses unnamed parameters. Consider using named parameters as they make usage of function more safe [UnnamedParameterUse]

to find the reported element I have to resort to lines and offsets. I'm guessing that the original intent was to put the text of the expression there instead of CALL_EXPRESSION.

While changing this behavior I also focused the report on the function name itself rather the the whole expression to prevent the usual large yellow blow in IDE (see #5316 for example).

Rule was added in #6055 cc @atulgpt (can't add you as reviewer for some reason)

Copy link

codecov bot commented Dec 3, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (1456279) 84.83% compared to head (7957c4a) 84.83%.

Files Patch % Lines
...rturbosch/detekt/rules/bugs/UnnamedParameterUse.kt 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6681      +/-   ##
============================================
- Coverage     84.83%   84.83%   -0.01%     
  Complexity     4098     4098              
============================================
  Files           570      570              
  Lines         13179    13180       +1     
  Branches       2418     2419       +1     
============================================
  Hits          11181    11181              
  Misses          789      789              
- Partials       1209     1210       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BraisGabin BraisGabin added the pick request Marker for PRs that should be ported to the 1.0 release branch label Dec 5, 2023
@TWiStErRob TWiStErRob merged commit 701ff37 into main Dec 5, 2023
22 of 23 checks passed
@TWiStErRob TWiStErRob deleted the report_name branch December 5, 2023 16:31
@cortinico cortinico removed the pick request Marker for PRs that should be ported to the 1.0 release branch label Jan 31, 2024
@cortinico
Copy link
Member

@BraisGabin heads up: this PR was flagged as pick request but this rule doesn't exist in 1.x so I won't be picking it

mgroth0 pushed a commit to mgroth0/detekt that referenced this pull request Feb 11, 2024
… function name) (detekt#6681)

* Add test for current behavior and shorten message

* Focus on the function call for reporting

* Report the function name in the message rather than CALL_EXPRESSION + grammar

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

Successfully merging this pull request may close these issues.

None yet

5 participants