Skip to content

Fix false positive on "bare unsigned" detection (-> adding word boundaries around)#64

Open
llacote-holberton wants to merge 1 commit intoalx-tools:masterfrom
llacote-holberton:patch-1
Open

Fix false positive on "bare unsigned" detection (-> adding word boundaries around)#64
llacote-holberton wants to merge 1 commit intoalx-tools:masterfrom
llacote-holberton:patch-1

Conversation

@llacote-holberton
Copy link
Copy Markdown

@llacote-holberton llacote-holberton commented Apr 5, 2026

Hello, nice to meet you! Hereunder summary of problem and reasoning behind suggested fix.

Error encountered

Betty wrongly detect use of "bare unsigned" and recommend unsigned int on a line just declaring the use of a function print_unsigned.
Example: table['u'] = print_unsigned;
Betty error: _printf.c:26: WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Diagnosis

The regex trying to find is not sufficiently restrictive.

Suggested fix

Adding word boundaries around unsigned to stop matching things like _unsigned or unsigned_.

Note: as I didn't study the ins and outs of that program I am not sure that my fix resolves this use-case without harming another.

…ries around

### Error encountered
Betty wrongly detect use of "bare unsigned" and recommend unsigned int on a line just declaring the use of a function print_unsigned.

### Diagnosis
The regex trying to find is not sufficiently restrictive.

### Suggested fix
Adding word boundaries around unsigned to stop matching things like _unsigned or unsigned_.
Note: as I didn't study the ins and outs of that program I am not sure that my fix resolves this use-case without harming another.
llacote-holberton pushed a commit to llacote-holberton/holbertonschool-printf that referenced this pull request Apr 5, 2026
Because of a bug in Betty linter, precisely in its
  betty-style.pl, which makes it trigger a warning
  on a false positive (print_unsigned function).

=> PR opened towards Betty maintainers to try and fix
 (cf alx-tools/Betty#64).
=> In the meantime function is renamed to be
  100% Betty compliant for the sake of exercise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant