Add unit test to prevent deprecated methods without description

And add missing descriptions
This commit is contained in:
Nyall Dawson 2018-05-25 15:25:18 +10:00
parent 8bb45b935a
commit 5e360f90e8
7 changed files with 21 additions and 12 deletions

View File

@ -110,7 +110,8 @@ Returns QFileInfo object for the project's associated file.
.. seealso:: :py:func:`fileName`
.. versionadded:: 2.9
\deprecated
.. deprecated:: Use absoluteFilePath(), baseName() or lastModifiedTime() instead
%End
QgsProjectStorage *projectStorage() const;

View File

@ -138,28 +138,28 @@ Sort this model by its display expression.
%Docstring
Does nothing except for calling beginRemoveRows()
\deprecated
.. deprecated:: Use beginRemoveRows() instead
%End
void onEndRemoveRows( const QModelIndex &parent, int first, int last );
%Docstring
Does nothing except for calling endRemoveRows()
\deprecated
.. deprecated:: Use endRemoveRows() instead
%End
void onBeginInsertRows( const QModelIndex &parent, int first, int last );
%Docstring
Does nothing except for calling beginInsertRows()
\deprecated
.. deprecated:: use beginInsertRows() instead
%End
void onEndInsertRows( const QModelIndex &parent, int first, int last );
%Docstring
Does nothing except for calling endInsertRows()
\deprecated
.. deprecated:: use endInsertRows() instead
%End
};

View File

@ -859,7 +859,8 @@ QGIS documentation, set useQgisDocDirectory to false.
:param url: URL to open
:param useQgisDocDirectory: If true, the URL will be formed by concatenating
url to the QGIS documentation directory path (prefix/share/doc)
\deprecated
.. deprecated:: Use QDesktopServices instead
%End
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false, bool showModal = true ) = 0;

View File

@ -158,7 +158,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
*
* \see fileName()
* \since QGIS 2.9
* \deprecated
* \deprecated Use absoluteFilePath(), baseName() or lastModifiedTime() instead
*/
Q_DECL_DEPRECATED QFileInfo fileInfo() const SIP_DEPRECATED;

View File

@ -143,28 +143,28 @@ class GUI_EXPORT QgsFeatureListModel : public QSortFilterProxyModel, public QgsF
/**
* Does nothing except for calling beginRemoveRows()
*
* \deprecated
* \deprecated Use beginRemoveRows() instead
*/
Q_DECL_DEPRECATED void onBeginRemoveRows( const QModelIndex &parent, int first, int last );
/**
* Does nothing except for calling endRemoveRows()
*
* \deprecated
* \deprecated Use endRemoveRows() instead
*/
Q_DECL_DEPRECATED void onEndRemoveRows( const QModelIndex &parent, int first, int last );
/**
* Does nothing except for calling beginInsertRows()
*
* \deprecated
* \deprecated use beginInsertRows() instead
*/
Q_DECL_DEPRECATED void onBeginInsertRows( const QModelIndex &parent, int first, int last );
/**
* Does nothing except for calling endInsertRows()
*
* \deprecated
* \deprecated use endInsertRows() instead
*/
Q_DECL_DEPRECATED void onEndInsertRows( const QModelIndex &parent, int first, int last );

View File

@ -698,7 +698,7 @@ class GUI_EXPORT QgisInterface : public QObject
* \param url URL to open
* \param useQgisDocDirectory If true, the URL will be formed by concatenating
* url to the QGIS documentation directory path (prefix/share/doc)
* \deprecated
* \deprecated Use QDesktopServices instead
*/
#ifndef Q_MOC_RUN
Q_DECL_DEPRECATED

View File

@ -527,11 +527,14 @@ class DoxygenParser():
pass
doxy_deprecated = False
has_description = True
try:
for p in member_elem.find('detaileddescription').getiterator('para'):
for s in p.getiterator('xrefsect'):
if s.find('xreftitle') is not None and 'Deprecated' in s.find('xreftitle').text:
doxy_deprecated = True
if s.find('xrefdescription') is None or s.find('xrefdescription').find('para') is None:
has_description = False
break
except:
assert 0, member_elem.find('definition').text
@ -539,6 +542,10 @@ class DoxygenParser():
if not decl_deprecated and not doxy_deprecated:
return False
if doxy_deprecated and not has_description:
assert has_description, 'Error: Missing description for deprecated method {}'.format(
member_elem.find('definition').text)
# only functions for now, but in future this should also apply for enums and variables
if member_elem.get('kind') in ('function', 'variable'):
assert decl_deprecated, 'Error: Missing Q_DECL_DEPRECATED for {}'.format(member_elem.find('definition').text)