-
Notifications
You must be signed in to change notification settings - Fork 728
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
Provide remove unused parameter/variable as quickfix. Fixes #5613 #5804
Provide remove unused parameter/variable as quickfix. Fixes #5613 #5804
Conversation
I think there are some issues in how multiline statements and statements with leading/trailing comments are handled. Here are some edge cases that repro issues and would be good to add as test cases: var adsf = 'asdf' /*
adf
*/ var asdf = {
abc: 'def'
} var abcd = concat('foo',/*
*/'bar') var multiline = '''
This
is
a
multiline
''' @description('''
''')
var asdf = 'asdf' var foo = 'asdf' // asdef /* asdfds */ var foo = 'asdf' #disable-next-line foo
param string asdf = 123 /* asdf */ var foo = 'asdf'
var bar = 'asdf' |
@StephenWeatherford can you clearify what kind of response you are waiting for (what am I supposed to fix) |
Thanks. Looked like there were still unresolved comments. GitHub's CR process is very lacking. I'll take a look. Always feel free to nudge if it looks like something is getting forgotten. |
Sorry for the delay, haven't forgotten. |
src/Bicep.Core/Analyzers/Linter/Rules/NoUnusedParametersRule.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor changes requested
I did the changes you requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, "type" would be an enum, not a string.
I'll leave it up to you if you want to update. Thanks for adding this!
Re-running tests. |
src/Bicep.Core/Analyzers/Linter/Rules/NoUnusedParametersRule.cs
Outdated
Show resolved
Hide resolved
@nilshedstrom I'll be OOF starting tomorrow for a couple of weeks. If I don't respond, @bhsubra can help finish the review. |
Hm, looks like we're getting a null ref exception during the tests in an unrelated rule:
Re-running test. Never seen that before. |
src/Bicep.Core/Analyzers/Linter/Rules/NoUnusedParametersRule.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggested but not required changes. We just need to make sure the tests pass.
Manually fixed merge conflicts |
@nilshedstrom Thanks! Looks great! |
This PR adds quickfixes for the linter rules no-unused-vars and no-unused-vars as suggested in issue #5613.
Because of failing unit tests I decided not provide linter rules no-unused-vars and no-unused-params for invalid parameters/variables (missing names)
@StephenWeatherford @majastrz