解决git commit 报错WARNING: Block comments use a trailing */ on a separate line

巴洲
2023-12-01

首先用一段报错的code作为示例:

/*struct ctrl_opt dtg_pt[] = {
*		{IP_DTG, 0xf8, 0x01},
*		{IP_DTG, 0xf0, 0x00},
	};*/

git commit会报错:

WARNING: Block comments should align the * on each line
#50: FILE: display-drivers/dsi_***.c:821:
+       /*struct ctrl_opt dtg_pt[] = {
+       *       {IP_DTG, 0xf8, 0x01},

WARNING: Block comments use a trailing */ on a separate line
#52: FILE: display-drivers/dsi_***.c:823:
+       };*/
 

针对第一个warning: Block comments should align the * on each line

表明每一行*都要对齐;

针对第二个warning:Block comments use a trailing */ on a separate line

表明*/要单独成一行

代码改成如下即可git commit成功。

/*struct ctrl_opt dtg_pt[] = {
 *		{IP_DTG, 0xf8, 0x01},
 *		{IP_DTG, 0xf0, 0x00},
 *};
 */

 类似资料: