You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/03/30 11:36:17 UTC
[GitHub] [incubator-nuttx] Ouss4 opened a new issue #652: NXStyle: Ignore
alignments of block comments at right of code
Ouss4 opened a new issue #652: NXStyle: Ignore alignments of block comments at right of code
URL: https://github.com/apache/incubator-nuttx/issues/652
NXstyle rightfully ignores single comments at right of code, for instance within a struct declaration.
But complaints about a block comment.
```C
struct a_struct_s
{
uint8_t f1; /* Long line in a single comment, OK. */
uint8_t f2; /* Long line in a block comment,
* nxstyle complains.
*/
};
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-nuttx] Ouss4 commented on issue #652: NXStyle: Ignore
alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-606016540
Tried this as well. I got the same complaints.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-nuttx] patacongo commented on issue #652: NXStyle:
Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-606010812
The */ is normally not on a separate line on right hand comments. Does this eliminte the problem?
struct a_struct_s
{
uint8_t f1; /* Long line in a single comment, OK. */
uint8_t f2; /* Long line in a block comment,
* nxstyle complains. */
};
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-nuttx] patacongo commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619383532
Looking back through the PR chekcs for I think I see the issue you are referring to: https://github.com/apache/incubator-nuttx/runs/562410318?check_suite_focus=true
The file is arch/arm/src/imxrt/imxrt_enc.c and these errors were reported:
arch/arm/src/imxrt/imxrt_enc.c:266:78: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:269:78: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:272:82: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:273:80: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:296:78: error: Long line found
Looking at those, I see that these are not related to the right hand comments at all. These are simply saying that the lines are too long. I verfied each that this is the case. The ARE too long.
When I run the current nxstyle against the current imxrt_enc.c I get:
$ tools/nxstyle.exe arch/arm/src/imxrt/imxrt_enc.c
arch/arm/src/imxrt/imxrt_enc.c:1037:81: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:1043:84: error: Long line found
To things to note:
1. The errors at liness 266-296 no longer appear. That is a regression. They truly are too long.
2. New long lines are reported at 1037 and 1043. These are correct and appear not due to a recent fix to nxstyle.
So I am thinking that this Issue should be closed. Please give your feeback before I close it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619384488
Yes, the lines are too long. But nxstyle ignores long lines when it's a comment at the right of struct field for instance.
This is used throughout the code base to comment struct fields, so the exception was added to nxstyle not too long ago.
The issue is, single line comments are ignored and no complaints is raised, however if it's a block (and long) comment, now nxstyle complains about the length.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] patacongo commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619381547
Can you please generate a test case? I created this file, junk.c:
/****************************************************************************
* junk.c
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* Private Types
****************************************************************************/
struct a_struct_s
{
uint8_t f1; /* Long line in a single comment, OK. */
uint8_t f2; /* Long line in a block comment,
* nxstyle complains.
*/
};
/****************************************************************************
* Public Functions
****************************************************************************/
But nxstyle is completely happy with that... no complaints at all. Nor have I ever seen a problem in the past. So I am thinking that this is context specific problem. So I think to resolve it, you will need to provide a full test file that shows the failure in context.
Is there an existing file in the repository?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] patacongo commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619385008
> Yes, the lines are too long. But nxstyle ignores long lines when it's a comment at the right of struct field for instance.
I does not, but it did not use too. That is a different error recently introduced into nxstyle when the right hand comment alignment logic was added. We lost the length check then.
> This is used throughout the code base to comment struct fields, so the exception was added to nxstyle not too long ago.
It wasn't added intentionally. It was an error that was introduced recently. Now it turns out, I think it is a good behavior at least for now because there are two many long, right-hand comments, espectially int arch/ header definition header files.
> The issue is, single line comments are ignored and no complaints is raised, however if it's a block (and long) comment, now nxstyle complains about the length.
Let me modify my junk.c to make the lines too long and try again.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] patacongo edited a comment on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
patacongo edited a comment on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619383532
Looking back through the PR chekcs for I think I see the issue you are referring to: https://github.com/apache/incubator-nuttx/runs/562410318?check_suite_focus=true
The file is arch/arm/src/imxrt/imxrt_enc.c and these errors were reported:
arch/arm/src/imxrt/imxrt_enc.c:266:78: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:269:78: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:272:82: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:273:80: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:296:78: error: Long line found
Looking at those, I see that these are not related to the right hand comments at all. These are simply saying that the lines are too long. I verfied each that this is the case. They ARE too long.
261 struct imxrt_qeconfig_s
262 {
263 uint32_t base; /* Register base address */
264 uint32_t init_val; /* Value to initialize position counters to */
265 uint32_t modulus; /* Modulus to use when modulo counting is enabled */
266 uint16_t in_filt_per; /* Period for input filter sampling in # of periph
267 * clock cycles
268 */
269 uint16_t in_filt_cnt; /* # of consecutive input filter samples that must
270 * agree
271 */
272 uint16_t init_flags; /* Flags to control which signals and edge transitions
273 * will reinitialize the position counter. Bits 4-0:
274 * [MOD, REV, XNE, XIP, HNE, HIP]
275 */
276
277 #ifdef CONFIG_DEBUG_SENSORS
278 bool tst_dir_adv; /* Whether to generate down/up test signals */
279 uint8_t tst_period; /* Period of PHASE pulses in # of periph clock cycles */
280 #endif
281 };
And
285 struct imxrt_enc_lowerhalf_s
286 {
287 /* The first field of this state structure must be a pointer to the lower-
288 * half callback structure:
289 */
290
291 FAR const struct qe_ops_s *ops; /* Lower half callback structure */
292
293 /* IMXRT driver-specific fields: */
294
295 FAR const struct imxrt_qeconfig_s *config; /* static configuration */
296 sem_t sem_excl; /* Mutual exclusion semaphore to
297 * ensure atomic 32-bit reads.
298 */
299 };
When I run the current nxstyle against the current imxrt_enc.c I get:
$ tools/nxstyle.exe arch/arm/src/imxrt/imxrt_enc.c
arch/arm/src/imxrt/imxrt_enc.c:1037:81: error: Long line found
arch/arm/src/imxrt/imxrt_enc.c:1043:84: error: Long line found
To things to note:
1. The errors at liness 266-296 no longer appear. That is a regression. They truly are too long.
2. New long lines are reported at 1037 and 1043. These are correct and appear not due to a recent fix to nxstyle.
So I am thinking that this Issue should be closed. Please give your feeback before I close it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] patacongo commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
patacongo commented on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619385870
Nope, no long line is reported. Here is the modified junk.c file:
/****************************************************************************
* junk.c
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* Private Types
****************************************************************************/
struct a_struct_s
{
uint8_t f1; /* This is a very long line in a single right-hand comment, No error is reported OK. */
uint8_t f2; /* This is a a very long line in a block comment. In this case nxstyle complains
* and an error is reported.
*/
};
/****************************************************************************
* Public Functions
****************************************************************************/
But nxstyle does not complain about the long lines at all. I am not sure that that is good. It is good for now, but there is no exception in the coding standard for long right hand comments. They are also a violation of the coding standard, we just do not want to deal with them now:
The long right hand comments in **arch/arm/src/imxrt/imxrt_enc.c** no longer generate errors either. So I conclude that this issue as reported no longer exists. I believe that there are still issues wtih long lines: They should be reported. But given the context of this issue, it can be closed now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 edited a comment on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
Ouss4 edited a comment on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619386128
> Let me modify my junk.c to make the lines too long and try again.
I did so too. And I confirm that nxstyle is working as it should be!
> Looking back through the PR chekcs for I think I see the issue you are referring to: https://github.com/apache/incubator-nuttx/runs/562410318?check_suite_focus=true
We can also see that some of the errors generated here no longer appear. An example is line 272.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on issue #652: NXStyle: Ignore alignments of block comments at right of code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on issue #652:
URL: https://github.com/apache/incubator-nuttx/issues/652#issuecomment-619386128
> Let me modify my junk.c to make the lines too long and try again.
I did so too. And I confirm that nxstyle is working as it should be!
> Looking back through the PR chekcs for I think I see the issue you are referring to: https://github.com/apache/incubator-nuttx/runs/562410318?check_suite_focus=true
We can also see that some of the errors generated here no longer appear. An example is line 272.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org