[clazy] [Bug 363540] New: detaching-member false positive if non-const reference is stored

2016-05-26 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=363540

Bug ID: 363540
   Summary: detaching-member false positive if non-const reference
is stored
   Product: clazy
   Version: unspecified
  Platform: Other
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: unassigned-b...@kde.org
  Reporter: nyall.daw...@gmail.com
CC: smart...@kde.org

The detaching-member test incorrectly flags the following code:

my_class  = list[index];
obj.someNonConstMember( 5 );
obj.someOtherNonConstMember( 10 );

Ideally the test would detect that the returned value is being stored in a
non-const reference and not throw the warning.

Reproducible: Always

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


[clazy] [Bug 359000] new check: warn about unused Qt objects

2016-02-17 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=359000

--- Comment #3 from Nyall Dawson  ---
Here's a simple test case:

#include 
#include 

int main(int, char **)
{
QString string; //no warning
QList list; //no warning
QVariant var; //no warning
QIcon i; //no warning

int num; //warning
}

building this with clang 3.7 warns only about the unused int variable, not the
unused QString/QList/QVariant etc.

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


[clazy] [Bug 359306] New: new check idea: avoid using Q_FOREACH to iterate over QMap/QHash keys and retrieve values inside loop

2016-02-12 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=359306

Bug ID: 359306
   Summary: new check idea: avoid using Q_FOREACH to iterate over
QMap/QHash keys and retrieve values inside loop
   Product: clazy
   Version: unspecified
  Platform: Other
OS: Linux
Status: UNCONFIRMED
  Severity: wishlist
  Priority: NOR
 Component: general
  Assignee: unassigned-b...@kde.org
  Reporter: nyall.daw...@gmail.com
CC: smart...@kde.org

Eg:

QMap map;

Q_FOREACH( const QString& key, map.keys() )
{
   QString val = map.value(key);
   ...
}

It's inefficient, and it'd be nice to catch this and suggest using
QMap::iterator/QHash::Iterator to iterate over both the keys and values at the
same time to avoid the unnecessary lookup.



Reproducible: Always

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


[clazy] [Bug 359305] New: false positives in container-anti-pattern

2016-02-12 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=359305

Bug ID: 359305
   Summary: false positives in container-anti-pattern
   Product: clazy
   Version: unspecified
  Platform: Other
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: unassigned-b...@kde.org
  Reporter: nyall.daw...@gmail.com
CC: smart...@kde.org

I'm just testing the new container-anti-pattern check and I get false positives
for code like:

 Q_FOREACH ( int id, someMap.keys() )
  {
   
  }

and 

someMap.keys().toSet()

I believe these are both false positives 



Reproducible: Always

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


[clazy] [Bug 359305] false positives in container-anti-pattern

2016-02-12 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=359305

Nyall Dawson  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Nyall Dawson  ---
Ah, ok. I get it now... Thanks for the pointers!

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


[clazy] [Bug 359000] New: new check: warn about unused Qt objects

2016-02-04 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=359000

Bug ID: 359000
   Summary: new check: warn about unused Qt objects
   Product: clazy
   Version: unspecified
  Platform: Other
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: unassigned-b...@kde.org
  Reporter: nyall.daw...@gmail.com
CC: smart...@kde.org

I'd find a check which warns on certain unused Qt objects which are created but
never used very helpful.

For instance, QString, Qt containers, QColor, QVariant. Interestingly, Qt
Creator highlights these unused variables but I can't find any way of listing
them in bulk for removal...

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


[clazy] [Bug 358519] rule-of-three: ignore trivial destructors

2016-01-25 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=358519

--- Comment #2 from Nyall Dawson  ---
I'm honestly not sure if there's any good reason for them, but the codebase I'm
working on is littered with them. 

Of course, if feel free to close this if you also think there's absolutely no
good reason why an empty destructor should be left in a project.

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


[clazy] [Bug 358519] rule-of-three: ignore trivial destructors

2016-01-25 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=358519

--- Comment #4 from Nyall Dawson  ---
I wonder if allowing any const calls might work too. This would allow
destructors with debugging and other non dangerous code.

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


[clazy] [Bug 358519] New: rule-of-three: ignore trivial destructors

2016-01-24 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=358519

Bug ID: 358519
   Summary: rule-of-three: ignore trivial destructors
   Product: clazy
   Version: unspecified
  Platform: Other
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: unassigned-b...@kde.org
  Reporter: nyall.daw...@gmail.com
CC: smart...@kde.org

The rule of three check should ignore trivial destructors - eg empty
destructors

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


[clazy] [Bug 356755] New: detaching-member: don't warn when begin()/end() used in qSort

2015-12-15 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=356755

Bug ID: 356755
   Summary: detaching-member: don't warn when begin()/end() used
in qSort
   Product: clazy
   Version: unspecified
  Platform: Other
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: unassigned-b...@kde.org
  Reporter: nyall.daw...@gmail.com
CC: smart...@kde.org

The following snippet shows a warning when using the detaching-member check:

qSort( list.begin(), list..end(), valueLessThan );

There's no way of avoiding a detachment in this case, so ideally no warning
would be shown.

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


[clazy] [Bug 356699] detaching-member: don't warn when non-const method is called on item

2015-12-14 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=356699

--- Comment #2 from Nyall Dawson  ---
yes, but in this case there's no way around calling the detaching [] operator

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


[clazy] [Bug 356699] detaching-member: don't warn when non-const method is called on item

2015-12-14 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=356699

--- Comment #5 from Nyall Dawson  ---
Yes - that's what I was referring to (values). Sorry, should have made that
clearer to begin with!

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


[clazy] [Bug 356699] detaching-member: don't warn when non-const method is called on item

2015-12-14 Thread Nyall Dawson via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=356699

--- Comment #6 from Nyall Dawson  ---
...And I also just realised my example was very poorly chosen ;)

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