Warning, /sdk/clazy/docs/checks/README-writing-to-temporary.md is written in an unsupported language. File is not indexed.
0001 # writing-to-temporary 0002 0003 Catches when calling setters on temporaries. 0004 #### Example 0005 `widget->sizePolicy().setHorizontalStretch(1);` 0006 0007 Which should instead be: 0008 ``` 0009 QSizePolicy sp = widget->sizePolicy(); 0010 sp.setHorizontalStretch(1); 0011 widget->setSizePolicy(sp); 0012 ``` 0013 0014 #### Requirements 0015 - The method must be of void return type, and must belong to one of these whitelisted classes: 0016 QList, QVector, QMap, QHash, QString, QSet, QByteArray, QUrl, QVarLengthArray, QLinkedList, QRect, QRectF, QBitmap, QVector2D, QVector3D, QVector4D, QSize, QSizeF, QSizePolicy 0017 0018 - Optionally, if you set env variable `CLAZY_EXTRA_OPTIONS="writing-to-temporary-widen-criteria"`, it will warn on any method with name starting with "set", regardless of it being whitelisted, example: 0019 `foo().setBar()`