[clazy] [Bug 377617] clazy-qstring-left makes false assumption

2017-03-19 Thread Sergio Martins
https://bugs.kde.org/show_bug.cgi?id=377617

Sergio Martins  changed:

   What|Removed |Added

 Resolution|--- |FIXED
  Latest Commit||https://commits.kde.org/cla
   ||zy/dcc6a8500bd079fe2a0d62a1
   ||9fe177bc892ac897
 Status|CONFIRMED   |RESOLVED

--- Comment #4 from Sergio Martins  ---
Git commit dcc6a8500bd079fe2a0d62a19fe177bc892ac897 by Sergio Martins.
Committed on 19/03/2017 at 12:26.
Pushed by smartins into branch '1.1'.

qstring-left: Warn the user to make sure string isn't empty

left(1) doesn't assert if string is empty, but at(0) does, so
inform the user about that in the warning message

M  +1-1src/checks/level1/qstring-left.cpp
M  +1-1tests/qstring-left/main.cpp.expected

https://commits.kde.org/clazy/dcc6a8500bd079fe2a0d62a19fe177bc892ac897

-- 
You are receiving this mail because:
You are watching all bug changes.

[clazy] [Bug 377617] clazy-qstring-left makes false assumption

2017-03-18 Thread bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=377617

--- Comment #3 from markus.enzenber...@gmail.com ---
The danger that I see right now is that someone runs clazy on code they didn't
write, simply follows the warning to replace left(1) by at(0) and thereby
introduces a new, maybe subtle and rarely triggered bug.

The optimal solution would be that clazy recognizes if a check for size 0
already exists in the code.

But as a short-time fix, maybe the warning message could be improved to mention
that left(1) can be replaced by at(0) if the string is not empty?

-- 
You are receiving this mail because:
You are watching all bug changes.

[clazy] [Bug 377617] clazy-qstring-left makes false assumption

2017-03-18 Thread Sergio Martins
https://bugs.kde.org/show_bug.cgi?id=377617

--- Comment #2 from Sergio Martins  ---
While that's true, it's still faster to call !isEmpty()+at(0) since they don't
allocate memory.

I don't see any solution besides improving the readme

-- 
You are receiving this mail because:
You are watching all bug changes.

[clazy] [Bug 377617] clazy-qstring-left makes false assumption

2017-03-18 Thread Sergio Martins
https://bugs.kde.org/show_bug.cgi?id=377617

--- Comment #1 from Sergio Martins  ---
Git commit 4234fabc16cbdf3d14ab05fc20f251fcb04719b2 by Sergio Martins.
Committed on 18/03/2017 at 11:43.
Pushed by smartins into branch '1.1'.

qstring-left: Improve readme

at(0) asserts if string is empty, while left(1) does not

M  +7-2src/checks/level1/README-qstring-left.md

https://commits.kde.org/clazy/4234fabc16cbdf3d14ab05fc20f251fcb04719b2

-- 
You are receiving this mail because:
You are watching all bug changes.

[clazy] [Bug 377617] clazy-qstring-left makes false assumption

2017-03-18 Thread Sergio Martins
https://bugs.kde.org/show_bug.cgi?id=377617

Sergio Martins  changed:

   What|Removed |Added

   Assignee|unassigned-b...@kde.org |smart...@kde.org

-- 
You are receiving this mail because:
You are watching all bug changes.

[clazy] [Bug 377617] clazy-qstring-left makes false assumption

2017-03-18 Thread Sergio Martins
https://bugs.kde.org/show_bug.cgi?id=377617

Sergio Martins  changed:

   What|Removed |Added

 Status|UNCONFIRMED |CONFIRMED
 Ever confirmed|0   |1

-- 
You are receiving this mail because:
You are watching all bug changes.

[clazy] [Bug 377617] clazy-qstring-left makes false assumption

2017-03-15 Thread bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=377617

markus.enzenber...@gmail.com changed:

   What|Removed |Added

 CC||markus.enzenber...@gmail.co
   ||m

-- 
You are receiving this mail because:
You are watching all bug changes.