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

Unused variable into code #16

Open
astik opened this issue Feb 12, 2012 · 3 comments
Open

Unused variable into code #16

astik opened this issue Feb 12, 2012 · 3 comments

Comments

@astik
Copy link
Contributor

astik commented Feb 12, 2012

When using eclipse (in my case indigo), validation can check for unused variable which is a very useful feature.

Into infoglue, right now, we can see that there are a lot of unused variable :

  • some are simple variable which are simply never user
  • some are variable defined to hold result of a method which is never used, so we cannot know if it is the variable that is useless or the method call ...

For example, into ChangeMultiContentStatePublishAction.java, we have on line 79 :
SiteNodeVersion siteNodeVersion = SiteNodeStateController.getController().changeState(siteNodeVersionId, SiteNodeVersionVO.PUBLISH_STATE, getVersionComment(), overrideVersionModifyer, this.recipientFilter, this.getInfoGluePrincipal(), null, events);
I can imagine that the method is useful but the created variable is useless and can be remove.
In some case, removing the defined variable can also lead to remove the needed import, that way we can reduce code coupling.

The project may need some clean up with eclipse help =/

@bogeblad
Copy link
Owner

Hi Romain,

The codebase sure needs a lot of cleanup. I totally agree. The issue is how
it's done. Either we do a huge cleanup effort in one go or we refactor each
class as we do other things. I'm swamped with feature development at the
moment so any help is apprechiated in this area but preferably one class at
a time as each needs review/test.

Regards
Mattias Bogeblad

2012/2/12 Romain Gonord <
reply@reply.github.com

When using eclipse (in my case indigo), validation can check for unused
variable which is a very useful feature.

Into infoglue, right now, we can see that there are a lot of unused
variable :

  • some are simple variable which are simply never user
  • some are variable defined to hold result of a method which is never
    used, so we cannot know if it is the variable that is useless or the method
    call ...

For example, into ChangeMultiContentStatePublishAction.java, we have on
line 79 :
SiteNodeVersion siteNodeVersion =
SiteNodeStateController.getController().changeState(siteNodeVersionId,
SiteNodeVersionVO.PUBLISH_STATE, getVersionComment(),
overrideVersionModifyer, this.recipientFilter, this.getInfoGluePrincipal(),
null, events);
I can imagine that the method is useful but the created variable is
useless and can be remove.
In some case, removing the defined variable can also lead to remove the
needed import, that way we can reduce code coupling.

The project may need some clean up with eclipse help =/


Reply to this email directly or view it on GitHub:
#16

@astik
Copy link
Contributor Author

astik commented Feb 15, 2012

Hi Mattias,
You're right it would be very difficult to do it at once.
I submitted a pull request with "easy to fix" clean up. This issue of unused variable code needs logic knowledge, so it would be difficult to the one outside the core team =/
So, my point is, it would be good to have some dev guideline (also maybe a formatter) to clean up new commited file, one at a time.
For the formatter, maybe we can use the default eclipse one, mybe set the default line length to 200 characters, ... In any case, the formatter should be available to developper.
What do you think of that ?

@astik
Copy link
Contributor Author

astik commented Feb 19, 2012

Argh, I sent a pull request with the wrong branch (i was pulling master, which has no difference with the official one =D). Now it's fixed.

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

No branches or pull requests

2 participants