1

I modified some code on windows in NotePad ++ and the code looks like this :

public enum Example {

    HELLO,
    WORLD;
}

But when I raise a Pull Request on a repo hosted on bitbucket the same code appears as follows :

public enum Example {

    HELLO,
 WORLD;
}

What is the reason for this difference in indentation and how can I avoid this?

CodePlorer
  • 153
  • 1
  • 15

1 Answers1

4

The difference is that you're using SPACE for one line, and TAB for the other.

BitBucket (and most other code repositories) will pick up these differences, and format your code poorly for their display.

In order to avoid this, you should ensure that you always use four spaces.

You can spot the difference in NotePad++ with:

View -> Show Symbol -> Show White Space And Tab

Which renders spaces as dots and tabs as arrows:

Space

Note that you can also force NotePad++ to convert your tabs into spaces (as noted by mrzli) under:

Settings -> Preferences -> Language -> Replace by space

Replace

You can choose to use another number of spaces, but for the majority of situations you'll want four.

Obsidian Age
  • 41,205
  • 10
  • 48
  • 71