Hi,

 

Thanks, Gyorgy for the info.

Agree, it’s good to have a unified coding style in all tf.org projects and we are following the Linux coding standard as you said. I tend to see CPL as an exception from the standard and allow being project specific because the selection is a bit subjective and is difficult to agree in a good number between multiple projects. For TF-M I think it’s good to recommend 100 chars as a soft limit but allow up to 140 for exceptional cases.

 

Editorconfig looks interesting and worth for TF-M adoption as a supportive, recommended tool. Happy to take it config from TS or TF-A. Thanks for the proposal.

 

Cheers,

Anton

 

From: Gyorgy Szing via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Tuesday, August 9, 2022 8:23 AM
To: tf-m@lists.trustedfirmware.org
Cc: nd <nd@arm.com>
Subject: [TF-M] Re: Proposal for coding standard update: Increase chars per line 80-> 128.

 

Hi,

 

Please consider alignment with other tf.org projects.

  1. Both TF-A and TS uses a 100 chars limit for C files. (See the .editorconfig files of the two projects [1] and [2]). Both project uses a standard compatible to the Linux Coding Standard. The latter sets a 100 characters line length limit.
  2. I suggest adoption of Editorconfig (see [3]).
    It seems TF-M is not using editorconfig files. Edtorcofig is supported by most editors and allows automated project specific configuration of the editor (line length, indentation, encoding, etc…). It makes editor settings directory and file type specific and thus places the control of these things in the hands of the currently edited project.
    “.editorcofig” files work similar to “.gitignore” files. Settings can have limited effects based on filename matching, and the scope is directory specific. A config file in a sub-directory may override settings from a file in a higher level directory, and will have an effect in the current directory and it’s sub directories. For more details please see [3].
    There is even a “static analyzer” which can check files for .editorconfig violations. See [4].

 

 

[1]: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/.editorconfig

[2]: https://git.trustedfirmware.org/TS/trusted-services.git/tree/.editorconfig?h=integration

[3]: https://editorconfig.org/
[4]: https://github.com/editorconfig-checker/editorconfig-checker

 

/George

 

From: Antonio De Angelis via TF-M <tf-m@lists.trustedfirmware.org>
Sent: 04 August 2022 15:16
To: tf-m@lists.trustedfirmware.org
Cc: nd <nd@arm.com>
Subject: [TF-M] Re: Proposal for coding standard update: Increase chars per line 80-> 128.

 

Checkpatch scripts will need to be changed accordingly, as I think they now fail for lines above 120 cols.

 

/Antonio

 

From: Anton Komlev via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Thursday, August 4, 2022 15:06
To: tf-m@lists.trustedfirmware.org
Cc: nd <nd@arm.com>
Subject: [TF-M] Re: Proposal for coding standard update: Increase chars per line 80-> 128.

 

Agree with David that a single rule is better than multiple exceptions. Thanks, Kevin for the good approach: Recommend to stay within 100 CPL everywhere but accept up to 140 if it really necessary.

 

Cheers,

Anton

 

From: Kevin Peng <Kevin.Peng@arm.com>
Sent: Wednesday, August 3, 2022 4:40 AM
To: David Hu <David.Hu@arm.com>; Ken Liu <Ken.Liu@arm.com>; Anton Komlev <Anton.Komlev@arm.com>; tf-m@lists.trustedfirmware.org
Cc: nd <nd@arm.com>
Subject: RE: Proposal for coding standard update: Increase chars per line 80-> 128.

 

How about setting to the limitation as large as possible and then having some recommendations/guidelines.

For example,

The limit is 140 for all – no exception.

For SPM – recommend to keep in 100.

For others – recommend to keep in 120.

 

I guess in most cases, developers wouldn’t try to use up all the limitations.

Sometimes, it’s about being only over several characters that is very annoying.

 

Best Regards,

Kevin

 

From: David Hu via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Wednesday, August 3, 2022 10:38 AM
To: Ken Liu <Ken.Liu@arm.com>; Anton Komlev <Anton.Komlev@arm.com>; tf-m@lists.trustedfirmware.org
Cc: nd <nd@arm.com>
Subject: [TF-M] Re: Proposal for coding standard update: Increase chars per line 80-> 128.

 

Hi Anton, Ken,

 

It is a good idea to increase the line limit.

I’d prefer to keep a single line limit in TF-M. Multiple limits may not be a good practice.

 

Can I suggest to set the limit to 100 chars right now, to fit both SPM and non-SPM part?

Besides, in non-SPM part, exceptions can be accepted for 128 chars.

 

Best regards,

Hu Ziji

 

From: Ken Liu via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Tuesday, August 2, 2022 7:16 PM
To: tf-m@lists.trustedfirmware.org
Cc: nd <nd@arm.com>
Subject: [TF-M] Re: Proposal for coding standard update: Increase chars per line 80-> 128.

 

No objections to making it a common guideline.

 

But I’d like to require SPM code to be in 80 as possible it could when review (In review comments) – as SPM contains some delicate logic, 80 columns would provide a better view in Gerrit to help the review.

 

/Ken

 

From: Anton Komlev via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Tuesday, August 2, 2022 6:17 PM
To: tf-m@lists.trustedfirmware.org
Cc: nd <nd@arm.com>
Subject: [TF-M] Proposal for coding standard update: Increase chars per line 80-> 128.

 

Hi,

 

TF-M coding standard mandates up to 80 characters per line. This looks a bit too restrictive nowadays with no punch cards or text terminals.

I propose to increase this limit to 120 or 140 characters. Personally like 128.

 

Are there any thoughts or objections against it?

 

Thanks,

Anton