nus-cs2030 / 2021-s2

2 stars 2 forks source link

CheckStyle indentation and tab #17

Open seanangwj opened 3 years ago

seanangwj commented 3 years ago

Summary

Description of the question / problem here.

I faced this issue upon using checkstyle.

Screenshot 2021-01-30 at 1 06 07 AM

Description:

I do not quite understand what the stated indentation level and expected level means as i do not think that i have 8 or 16 spaces of indentations in my code. Also, i do not know how to really get rid of the tab character even though i have tried removing it.

Clarifications or details with respect to the issue you are facing

Code Snippets

Attach code snippets (if any)

Screenshots

Attached is the screenshot

Screenshots (if any)

brendancjz commented 3 years ago

Tried helping Sean in this matter but to no avail... Let's see if anyone else face the same issue.

Yung-Jer commented 3 years ago

set expandtab set tabstop=4 set shiftwidth=4 set autoindent set smartindent have u included these in your ~/.vimrc?

seanangwj commented 3 years ago

Yes, i included a few like set tabstop =4, set shiftwidth =4, set smartindent.

seanlowjk commented 3 years ago

The .vimrc file might not be the actual one you are using.

May I know if you are using any IDE to edit your java code?

Zekeseoj commented 3 years ago

Hi I am also having this issue, I get my vimrc file using sudo vim .vimrc, then override the file with the above commands. But when i tried to checkstyle it, a ton of errors occurs like OP had. I used ubuntu vim to edit my code. Also to note that my java files are located in my C directory as shown in the 2nd picture. How can i fix this issue?

This shows how i executed my vimrc edit

Screenshot 2021-02-01 182329

This shows the same/similar issues that OP has.

Screenshot 2021-02-01 182234

nhzaci commented 3 years ago

Hi I am also having this issue, I get my vimrc file using sudo vim .vimrc, then override the file with the above commands. But when i tried to checkstyle it, a ton of errors occurs like OP had. I used ubuntu vim to edit my code. Also to note that my java files are located in my C directory as shown in the 2nd picture. How can i fix this issue?

This shows how i executed my vimrc edit

Screenshot 2021-02-01 182329

This shows the same/similar issues that OP has.

Screenshot 2021-02-01 182234

Hey Zekeseoj,

Could I just check if you have done gg=G after placing those lines inside your .vimrc?

Also, using sudo would not be necessary, just vim will do :)

Please do let us know if you continue to have issues after doing gg=G

brendancjz commented 3 years ago

Zeke, input the code Yung Jer sent into your .vimrc file. type gg=G and it should be fine after you compile.

Zekeseoj commented 3 years ago

Okay I got it, turns out the vimrc file I was editing was not the correct file. Thanks!