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

Use one line for each declaration, it enhances code readability. #425

Closed
carlwilson opened this issue Mar 26, 2019 · 2 comments
Closed

Use one line for each declaration, it enhances code readability. #425

carlwilson opened this issue Mar 26, 2019 · 2 comments
Labels
bug A product defect that needs fixing P3 Low priority bugs

Comments

@carlwilson
Copy link
Member

There are 6 occurrences of this issue.
Why is this an issue?
Since: PMD 5.0

Java allows the use of several variables declaration of the same type on one line. However, it can lead to quite messy code. This rule looks for several declarations on the same line.

Example(s):

String name;            // separate declarations
String lastname;

String name, lastname;  // combined declaration, a violation

String name,
       lastname;        // combined declaration on multiple lines, no violation by default.
                        // Set property strictMode to true to mark this as violation.

A full list of issues can be found here on Codacy

@carlwilson carlwilson added bug A product defect that needs fixing P3 Low priority bugs labels Mar 26, 2019
@garvita-jain
Copy link
Contributor

Can I work on this issue?
Which code do I need to work on exactly?

@carlwilson
Copy link
Member Author

Hi @garvita-jain the link I provided wasn't that helpful. Three are 7 occurrences of this problem listed here. In each case the declarations simply need to be split into individual declarations, e.g.

int i = 0, j = 0, k = 0;

becomes

int i = 0;
int j = 0;
int k = 0;

Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A product defect that needs fixing P3 Low priority bugs
Projects
None yet
Development

No branches or pull requests

2 participants