Help regarding the code formatting
Hi, I am kind of getting started with NuttX and am adding minimalistic board/chip already not available in the NuttX repo. I would like to create a pull request and get help in evaluating the additions and support in debugging. I was looking through the coding standard, and I am kinda confused about how to properly run through the necessary checks. Is there some documentation regarding how to carry that out? Or is there a formatting script available which formats, at least, indentation, and horizontal/vertical spacing at once, which can be integrated into VSCode? Best Regards, Janardhan
Re: Help regarding the code formatting
Hi Janardhan: I have an article that explains the "nxstyle" tool, maybe this will help? https://lupyuen.github.io/articles/pr#check-coding-style I'm not aware of a script that does auto-formatting for NuttX Code. I do it manually in VSCode :-) Lup On Fri, May 3, 2024 at 3:24 PM Janardhan Silwal wrote: > Hi, > > I am kind of getting started with NuttX and am adding minimalistic > board/chip already not available in the NuttX repo. > > I would like to create a pull request and get help in evaluating the > additions and support in debugging. > > I was looking through the coding standard, and I am kinda confused about > how to properly run through the necessary checks. Is there some > documentation regarding how to carry that out? > > Or is there a formatting script available which formats, at least, > indentation, and horizontal/vertical spacing at once, which can be > integrated into VSCode? > > Best Regards, > Janardhan >
Re: Help regarding the code formatting
On 5/3/2024 2:12 AM, Lee, Lup Yuen wrote: https://lupyuen.github.io/articles/pr#check-coding-style Nice article. This would be good to have in the documentation. I'm not aware of a script that does auto-formatting for NuttX Code. I do it manually in VSCode :-) There used to be a couple of scripts under tools used standard pretty printer programs to format NuttX code. Those were imperfect, however, and it appear to have been removed (probably for that reason). The coding style is similar to the GNU coding style with some extensions and differences. There is an official FSF GNJ coding style document but it is universally disliked, not because of the coding style, but because it is so long, "preachy", and controversial.. like a political manifesto. The Wikipedia article is short: https://en.wikipedia.org/wiki/GNU_coding_standards
Re: Help regarding the code formatting
Thank you so much Greg! I'll copy and paste the relevant sections into the NuttX Docs. Lup On Fri, May 3, 2024 at 10:04 PM Gregory Nutt wrote: > On 5/3/2024 2:12 AM, Lee, Lup Yuen wrote: > > https://lupyuen.github.io/articles/pr#check-coding-style > Nice article. This would be good to have in the documentation. > > I'm not aware of a script that does auto-formatting for NuttX Code. I do > it > > manually in VSCode :-) > > There used to be a couple of scripts under tools used standard pretty > printer programs to format NuttX code. Those were imperfect, however, > and it appear to have been removed (probably for that reason). > > The coding style is similar to the GNU coding style with some extensions > and differences. There is an official FSF GNJ coding style document but > it is universally disliked, not because of the coding style, but because > it is so long, "preachy", and controversial.. like a political > manifesto. The Wikipedia article is short: > https://en.wikipedia.org/wiki/GNU_coding_standards > > >
Re: Help regarding the code formatting
Hi Janardhan, Please read the official documentation: https://nuttx.apache.org/docs/latest/contributing/making-changes.html There is a tool called checkpatch.sh that you can use to verify the coding style issues in your source code. Best Regards, Alan On Fri, May 3, 2024 at 4:25 AM Janardhan Silwal wrote: > Hi, > > I am kind of getting started with NuttX and am adding minimalistic > board/chip already not available in the NuttX repo. > > I would like to create a pull request and get help in evaluating the > additions and support in debugging. > > I was looking through the coding standard, and I am kinda confused about > how to properly run through the necessary checks. Is there some > documentation regarding how to carry that out? > > Or is there a formatting script available which formats, at least, > indentation, and horizontal/vertical spacing at once, which can be > integrated into VSCode? > > Best Regards, > Janardhan >
Re: Help regarding the code formatting
Hi Lee, Nice documentation. Contains everything I needed and, what I might need later. Thank you!! Janardhan From: Lee, Lup Yuen Sent: Friday, May 3, 2024 13:57 To: dev@nuttx.apache.org Subject: Re: Help regarding the code formatting Hi Janardhan: I have an article that explains the "nxstyle" tool, maybe this will help? https://lupyuen.github.io/articles/pr#check-coding-style I'm not aware of a script that does auto-formatting for NuttX Code. I do it manually in VSCode :-) Lup On Fri, May 3, 2024 at 3:24 PM Janardhan Silwal wrote: > Hi, > > I am kind of getting started with NuttX and am adding minimalistic > board/chip already not available in the NuttX repo. > > I would like to create a pull request and get help in evaluating the > additions and support in debugging. > > I was looking through the coding standard, and I am kinda confused about > how to properly run through the necessary checks. Is there some > documentation regarding how to carry that out? > > Or is there a formatting script available which formats, at least, > indentation, and horizontal/vertical spacing at once, which can be > integrated into VSCode? > > Best Regards, > Janardhan >