Bad loop construct

2022-05-24 Thread Steve Grubb
Hello, I am continuing to look at ShellCheck and how to map it's warnings to CWE's. I'm looking at SC2043 - This loop will only ever run once for a constant value. https://www.shellcheck.net/wiki/SC2043 An example might be: dir=$(ls $HOME) for i in dir do echo $i done which outputs "dir" b

Re: Bad loop construct

2022-05-24 Thread Steve Grubb
On Tuesday, May 24, 2022 1:55:17 PM EDT Kurt Seifried wrote: > On Tue, May 24, 2022 at 9:25 AM Steve Grubb wrote: > > Hello, > > > > I am continuing to look at ShellCheck and how to map it's warnings to > > CWE's. > > I'm looking at SC2043 -

Re: Bad loop construct

2022-05-31 Thread Steve Grubb
Hello everyone, On Tuesday, May 24, 2022 5:49:57 PM EDT Steven M Christey wrote: > Kurt said “I've seen code with loops of one because of future growth, or > because various options were removed and it's easier than refactoring the > code” – so a CWE-related writeup wouldn’t want to inadvertently