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 lint rule for UnusedTaskIntent #26005

Merged
merged 8 commits into from
Oct 1, 2024

Conversation

jabraham17
Copy link
Member

@jabraham17 jabraham17 commented Sep 26, 2024

Adds a new lint rule UnusedTaskIntent. This is similar to UnusedFormal and UnusedLoopIndex and warns for unused task intents like the following

var a = 1;
begin with (ref a) { }

Since a is not used, it can be safely removed.

Note that the following is not warning for, since task private variables could have side effects

begin with (var x = ...) { }

This PR also fixes an issue where @chplcheck.ignore was being added to AstNode's that did not support attributes for the IncorrectIndentation rule

Future work: Improve the naming of sub-location method names like block_header and header_location

[Reviewed by @DanilaFe]

Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
tools/chplcheck/src/rules.py Outdated Show resolved Hide resolved
test/chplcheck/UnusedTaskIntent.good-fixit Outdated Show resolved Hide resolved
Copy link
Contributor

@DanilaFe DanilaFe 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 but in retrospect I think we need to fix up / make more consistent the names of the various additional location fns ("block header" vs "header location" is confusing to me here.

Signed-off-by: Jade Abraham <[email protected]>
@jabraham17 jabraham17 merged commit 0c094d6 into chapel-lang:main Oct 1, 2024
8 checks passed
@jabraham17 jabraham17 deleted the add-UnusedTaskIntent branch October 1, 2024 00:05
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.

2 participants