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

issue-93. added new consider_making_a_member_privat rule #188

Closed
wants to merge 3 commits into from

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