Indentation Style
-
Just wondering what many of the scripters and developers here like to use as their Indentation Style?
I was looking at my pretty messed up .PS1 scripts and trying to figure out which of the styles from https://en.wikipedia.org/wiki/Indentation_style
would make my scripts look more organized.I find I am partial to Allman style. It seems that code blocks are more noticeable and finding a missing bracket seems easier.
-
@pmoncho said in Indentation Style:
Just wondering what many of the scripters and developers here like to use as their Indentation Style?
I was looking at my pretty messed up .PS1 scripts and trying to figure out which of the styles from https://en.wikipedia.org/wiki/Indentation_style
would make my scripts look more organized.I find I am partial to Allman style. It seems that code blocks are more noticeable and finding a missing bracket seems easier.
wow - that's a lot of options.
I think I like whitesmith personally.
-
@dashrender said in Indentation Style:
@pmoncho said in Indentation Style:
Just wondering what many of the scripters and developers here like to use as their Indentation Style?
I was looking at my pretty messed up .PS1 scripts and trying to figure out which of the styles from https://en.wikipedia.org/wiki/Indentation_style
would make my scripts look more organized.I find I am partial to Allman style. It seems that code blocks are more noticeable and finding a missing bracket seems easier.
wow - that's a lot of options.
I think I like whitesmith personally.
I didn't know till I looked also.
Whitesmith is nice too. Hmmm... decisions...decisions...
I am partial to using Tab's instead of space bar four times. Apparently this is a full-on debate about using Tab's that I did not know about either.
-
@pmoncho tab indentation needs to die in nuclear fire.
Thankfully, modern IDE systems like Visual Studio Code and others all auto swap a tab for 4 spaces by default.
Personally, I prefer a 2 space indentation, but 4 seems to be the most common.
-
I'm more of a fan of K&R .
I definitely agree with @JaredBusch two spaces for the win.
-
@jaredbusch said in Indentation Style:
@pmoncho tab indentation needs to die in nuclear fire.
Thankfully, modern IDE systems like Visual Studio Code and others all auto swap a tab for 4 spaces by default.
Personally, I prefer a 2 space indentation, but 4 seems to be the most common.
I agree on the demise of tabs. Training on Ansible over the last year has solidified my dislike of tabs.
-
Good to know. Have to take that into consideration should I get into scripting more.
-
@jaredbusch said in Indentation Style:
@pmoncho tab indentation needs to die in nuclear fire.
Thankfully, modern IDE systems like Visual Studio Code and others all auto swap a tab for 4 spaces by default.
Personally, I prefer a 2 space indentation, but 4 seems to be the most common.
I didn't think Tab's were that big of a deal as I never had an issue between Vi, Nano, Notepad or Notepad++. I guess it is mostly a habit from using text editors.
Hmm... I always hated having press the space bar more than twice (only after "." mostly). Maybe I will try using two spaces in the next script to see how that pans out.