Skip to content

Conversation

@StarovNikita
Copy link
Contributor

No description provided.

Comment on lines 5 to 19
class X {
// expect_lint:consider_making_a_member_private
void unusedX() {}

// no lint
void usedX() {}
}

class Y {
// no lint
void _y() {
final x = X();
x.usedX();
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add more tests for:

  • fields (static, final, mutable)
  • getters, setters
  • methods (static/instance)
  • constructors, factories

We should also consider this for non-class declarations (global functions, variables, constants) and class declarations as a whole.

Comment on lines 56 to 65
class Y {
// no lint
void _y() {
final x = X();
X.usedFactory();
x.usedMethodX();
usedGLobalFunction();
usedGlobalVariables;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not quite what the lint is supposed to do.

With the structure of the test, all these methods and functions could just as well be private too.

We should lint if the class/method/functions are not used outside the file where they are declared.

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