I'm using Checkstyle for Java in Eclipse IDE. I don't know in every java file, at second line, I always receive warning in Checkstyle : (although I'm pretty sure that I don't press tab key)
File contains tab characters (this is the first instance).
public class Percolation { private boolean[][] grid; ... }
When I have typed : public class Percolation {
, press enter, Eclipse will make an indent for me, after that, I type private boolean[][] grid;
. But, I still receive this warning.
Please tell me how to fix this. (I don't want to turn off this warning, because this is a must. Another people will check again my file).
Thanks :)
To fix this Navigate to Preferences > Java > Code Style > Formatter. Then click on New > give name for the formatter > click on ok .
step 1 In eclipse, Preference > Java > Code Style > Formatter. Edit the Active profile.(If you don't wish to edit the built-in profile , create a new profile). Under "Active profile:" there is a drop down dialogue box .. beside it, click "Edit..." which opens up the edit dialog box. Under the "Indention" tab, you'll find Tab Policy. Change the Tab Policy from Mixed to Space only & apply the changes.
step 2 Back to your Eclipse Perspective, navigate via the menu bar: Source > Format Element (not "Format") and save.
Run checkstyle you won't find "File Tab Character: File contains tab characters (this is the first instance)." warning anymore.
To visualize the difference by enabling whitespace character that you'll find in tool bar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With