nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

[BUG] NXStyle is not catching brackets starting in the same line

Open acassis opened this issue 7 months ago • 2 comments

Description / Steps to reproduce the issue

Image

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

N/A

NuttX Version

mainline

Issue Architecture

[Arch: all]

Issue Area

[Area: Other]

Host information

No response

Verification

  • [x] I have verified before submitting the report.

acassis avatar May 13 '25 09:05 acassis

Locally? CI? Steps to reproduce?

Works for me using checkpatch.sh

TimJTi avatar May 13 '25 10:05 TimJTi

Hi @TimJTi this print is from AVR PR: https://github.com/apache/nuttx/pull/16365

acassis avatar May 13 '25 12:05 acassis

also on nau7802 driver:

struct i2c_msg_s readcmd[2] = {

acassis avatar Jul 14 '25 12:07 acassis

It's FUBAR!!! It even accepts this which has MANY style errors:

static int nau7802_read_reg(FAR nau7802_dev_s *dev, uint8_t addr, void *buf,
                            uint8_t nbytes)
{
  struct i2c_msg_s readcmd[2] =          {
          {
     .frequency = CONFIG_SENSORS_NAU7802_I2C_FREQUENCY,
     .addr = dev->addr,
     .flags = I2C_M_NOSTOP,
     .buffer = &addr,
     .length = sizeof(addr),
      },
          {
      .frequency = CONFIG_SENSORS_NAU7802_I2C_FREQUENCY,
        .addr = dev->addr,
          .flags = I2C_M_READ,
            .buffer = buf,
              .length = nbytes,
           },
                      };

  return I2C_TRANSFER(dev->i2c, readcmd, 2);
}
Tims-MacBook-Air nuttx: ./tools/checkpatch.sh -f drivers/sensors/nau7802.c
Tims-MacBook-Air nuttx:

Guess someone broke it and a bisect is needed on the script?

TimJTi avatar Jul 14 '25 12:07 TimJTi

@TimJTi good question! I think it used to work in the past, because Greg implemented nxstyle to be consistent with the Coding Style guy, but we need to confirm it, for example downloading an old nuttx release and testing nxstyle against this same file.

acassis avatar Jul 14 '25 12:07 acassis

@TimJTi I downloaded NuttX 9.1 and noticed it also wasn't able to detect the issue, you are right, it is "FUBAR"

alan@dev:/tmp/patacongo-nuttx-e4e4cce69624/tools$ ./nxstyle /tmp/nau7802.c
alan@dev:/tmp/patacongo-nuttx-e4e4cce69624/tools$

It needs to be fixed :-/

acassis avatar Jul 14 '25 12:07 acassis