Skip to content

Commit 5e360f9

Browse files
committedMay 25, 2018
Add unit test to prevent deprecated methods without description
And add missing descriptions
1 parent 8bb45b9 commit 5e360f9

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed
 

‎python/core/auto_generated/qgsproject.sip.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ Returns QFileInfo object for the project's associated file.
110110
.. seealso:: :py:func:`fileName`
111111

112112
.. versionadded:: 2.9
113-
\deprecated
113+
114+
.. deprecated:: Use absoluteFilePath(), baseName() or lastModifiedTime() instead
114115
%End
115116

116117
QgsProjectStorage *projectStorage() const;

‎python/gui/auto_generated/attributetable/qgsfeaturelistmodel.sip.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,28 +138,28 @@ Sort this model by its display expression.
138138
%Docstring
139139
Does nothing except for calling beginRemoveRows()
140140

141-
\deprecated
141+
.. deprecated:: Use beginRemoveRows() instead
142142
%End
143143

144144
void onEndRemoveRows( const QModelIndex &parent, int first, int last );
145145
%Docstring
146146
Does nothing except for calling endRemoveRows()
147147

148-
\deprecated
148+
.. deprecated:: Use endRemoveRows() instead
149149
%End
150150

151151
void onBeginInsertRows( const QModelIndex &parent, int first, int last );
152152
%Docstring
153153
Does nothing except for calling beginInsertRows()
154154

155-
\deprecated
155+
.. deprecated:: use beginInsertRows() instead
156156
%End
157157

158158
void onEndInsertRows( const QModelIndex &parent, int first, int last );
159159
%Docstring
160160
Does nothing except for calling endInsertRows()
161161

162-
\deprecated
162+
.. deprecated:: use endInsertRows() instead
163163
%End
164164

165165
};

‎python/gui/auto_generated/qgisinterface.sip.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,8 @@ QGIS documentation, set useQgisDocDirectory to false.
859859
:param url: URL to open
860860
:param useQgisDocDirectory: If true, the URL will be formed by concatenating
861861
url to the QGIS documentation directory path (prefix/share/doc)
862-
\deprecated
862+
863+
.. deprecated:: Use QDesktopServices instead
863864
%End
864865

865866
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false, bool showModal = true ) = 0;

‎src/core/qgsproject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
158158
*
159159
* \see fileName()
160160
* \since QGIS 2.9
161-
* \deprecated
161+
* \deprecated Use absoluteFilePath(), baseName() or lastModifiedTime() instead
162162
*/
163163
Q_DECL_DEPRECATED QFileInfo fileInfo() const SIP_DEPRECATED;
164164

‎src/gui/attributetable/qgsfeaturelistmodel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,28 +143,28 @@ class GUI_EXPORT QgsFeatureListModel : public QSortFilterProxyModel, public QgsF
143143
/**
144144
* Does nothing except for calling beginRemoveRows()
145145
*
146-
* \deprecated
146+
* \deprecated Use beginRemoveRows() instead
147147
*/
148148
Q_DECL_DEPRECATED void onBeginRemoveRows( const QModelIndex &parent, int first, int last );
149149

150150
/**
151151
* Does nothing except for calling endRemoveRows()
152152
*
153-
* \deprecated
153+
* \deprecated Use endRemoveRows() instead
154154
*/
155155
Q_DECL_DEPRECATED void onEndRemoveRows( const QModelIndex &parent, int first, int last );
156156

157157
/**
158158
* Does nothing except for calling beginInsertRows()
159159
*
160-
* \deprecated
160+
* \deprecated use beginInsertRows() instead
161161
*/
162162
Q_DECL_DEPRECATED void onBeginInsertRows( const QModelIndex &parent, int first, int last );
163163

164164
/**
165165
* Does nothing except for calling endInsertRows()
166166
*
167-
* \deprecated
167+
* \deprecated use endInsertRows() instead
168168
*/
169169
Q_DECL_DEPRECATED void onEndInsertRows( const QModelIndex &parent, int first, int last );
170170

‎src/gui/qgisinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ class GUI_EXPORT QgisInterface : public QObject
698698
* \param url URL to open
699699
* \param useQgisDocDirectory If true, the URL will be formed by concatenating
700700
* url to the QGIS documentation directory path (prefix/share/doc)
701-
* \deprecated
701+
* \deprecated Use QDesktopServices instead
702702
*/
703703
#ifndef Q_MOC_RUN
704704
Q_DECL_DEPRECATED

‎tests/code_layout/doxygen_parser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,18 +527,25 @@ def isDeprecated(self, member_elem):
527527
pass
528528

529529
doxy_deprecated = False
530+
has_description = True
530531
try:
531532
for p in member_elem.find('detaileddescription').getiterator('para'):
532533
for s in p.getiterator('xrefsect'):
533534
if s.find('xreftitle') is not None and 'Deprecated' in s.find('xreftitle').text:
534535
doxy_deprecated = True
536+
if s.find('xrefdescription') is None or s.find('xrefdescription').find('para') is None:
537+
has_description = False
535538
break
536539
except:
537540
assert 0, member_elem.find('definition').text
538541

539542
if not decl_deprecated and not doxy_deprecated:
540543
return False
541544

545+
if doxy_deprecated and not has_description:
546+
assert has_description, 'Error: Missing description for deprecated method {}'.format(
547+
member_elem.find('definition').text)
548+
542549
# only functions for now, but in future this should also apply for enums and variables
543550
if member_elem.get('kind') in ('function', 'variable'):
544551
assert decl_deprecated, 'Error: Missing Q_DECL_DEPRECATED for {}'.format(member_elem.find('definition').text)

0 commit comments

Comments
 (0)
Please sign in to comment.