Skip to content

Commit aecd96f

Browse files
authored
Merge pull request #61833 from nyalldawson/conformance
Add conformance tests for algorithm descriptions
2 parents 4fed6ea + d309cf2 commit aecd96f

File tree

51 files changed

+288
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+288
-60
lines changed

python/plugins/processing/algs/qgis/ImportIntoSpatialite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def displayName(self):
141141
return self.tr("Export to SpatiaLite")
142142

143143
def shortDescription(self):
144-
return self.tr("Exports a vector layer to a SpatiaLite database")
144+
return self.tr("Exports a vector layer to a SpatiaLite database.")
145145

146146
def tags(self):
147147
return self.tr("import,table,layer,into,copy").split(",")

python/plugins/processing/algs/qgis/PostGISExecuteAndLoadSQL.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def displayName(self):
9797

9898
def shortDescription(self):
9999
return self.tr(
100-
"Executes a SQL command on a PostgreSQL database and loads the result as a table"
100+
"Executes a SQL command on a PostgreSQL database and loads the result as a table."
101101
)
102102

103103
def tags(self):

python/plugins/processing/tests/AlgorithmsTestBase.py

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,235 @@ def check_algorithm(self, alg):
555555
# check that calling helpUrl() works without error
556556
alg.helpUrl()
557557

558+
if alg.provider().id() in ("qgis", "native", "3d"):
559+
if alg.id() not in ("qgis:rectanglesovalsdiamondsvariable",):
560+
self.assertTrue(
561+
alg.shortHelpString(),
562+
f"Algorithm {alg.id()} has not shortHelpString!",
563+
)
564+
565+
if alg.id() not in (
566+
"native:addhistorymetadata",
567+
"native:adduniquevalueindexfield",
568+
"native:bufferbym",
569+
"native:convertgpsdata",
570+
"native:convertgpxfeaturetype",
571+
"native:converttocurves",
572+
"native:copylayermetadata",
573+
"native:creategrid",
574+
"native:createpointslayerfromtable",
575+
"native:createrandombinomialrasterlayer",
576+
"native:createrandomexponentialrasterlayer",
577+
"native:createrandomgammarasterlayer",
578+
"native:createrandomgeometricrasterlayer",
579+
"native:createrandomnegativebinomialrasterlayer",
580+
"native:createrandomnormalrasterlayer",
581+
"native:createrandompoissonrasterlayer",
582+
"native:createrandomuniformrasterlayer",
583+
"native:createspatialindex",
584+
"native:deleteholes",
585+
"native:downloadgpsdata",
586+
"native:dtmslopebasedfilter",
587+
"native:equaltofrequency",
588+
"native:explodehstorefield",
589+
"native:exportaddgeometrycolumns",
590+
"native:exportlayermetadata",
591+
"native:exportlayersinformation",
592+
"native:exporttospreadsheet",
593+
"native:extenttolayer",
594+
"native:extractbyattribute",
595+
"native:extractbyexpression",
596+
"native:extractbyextent",
597+
"native:extractbylocation",
598+
"native:extractspecificvertices",
599+
"native:extractvertices",
600+
"native:fieldcalculator",
601+
"native:fillnodata",
602+
"native:fillsinkswangliu",
603+
"native:filter",
604+
"native:filterverticesbym",
605+
"native:filterverticesbyz",
606+
"native:fixgeometries",
607+
"native:fuzzifyrastergaussianmembership",
608+
"native:fuzzifyrasterlargemembership",
609+
"native:fuzzifyrasterlinearmembership",
610+
"native:fuzzifyrasternearmembership",
611+
"native:fuzzifyrasterpowermembership",
612+
"native:fuzzifyrastersmallmembership",
613+
"native:generateelevationprofileimage",
614+
"native:generatepointspixelcentroidsinsidepolygons",
615+
"native:geometrybyexpression",
616+
"native:gltftovector",
617+
"native:greaterthanfrequency",
618+
"native:highestpositioninrasterstack",
619+
"native:hillshade",
620+
"native:importphotos",
621+
"native:intersection",
622+
"native:joinattributestable",
623+
"native:keepnbiggestparts",
624+
"native:kmeansclustering",
625+
"native:lessthanfrequency",
626+
"native:linedensity",
627+
"native:lineintersections",
628+
"native:loadlayer",
629+
"native:lowestpositioninrasterstack",
630+
"native:meancoordinates",
631+
"native:mergelines",
632+
"native:minimumenclosingcircle",
633+
"native:modelerrastercalc",
634+
"native:modelervirtualrastercalc",
635+
"native:multidifference",
636+
"native:multiintersection",
637+
"native:multiparttosingleparts",
638+
"native:multiringconstantbuffer",
639+
"native:multiunion",
640+
"native:nearestneighbouranalysis",
641+
"native:orderbyexpression",
642+
"native:orientedminimumboundingbox",
643+
"native:orthogonalize",
644+
"native:package",
645+
"native:pointonsurface",
646+
"native:pointstopath",
647+
"native:pointtolayer",
648+
"native:poleofinaccessibility",
649+
"native:polygonfromlayerextent",
650+
"native:polygonize",
651+
"native:projectpointcartesian",
652+
"native:promotetomulti",
653+
"native:randomextract",
654+
"native:randompointsinextent",
655+
"native:randompointsinpolygons",
656+
"native:randompointsonlines",
657+
"native:rastercalc",
658+
"native:rasterlayerproperties",
659+
"native:rasterlayerstatistics",
660+
"native:rasterlayeruniquevaluesreport",
661+
"native:rasterrank",
662+
"native:reclassifybylayer",
663+
"native:reclassifybytable",
664+
"native:rectanglesovalsdiamonds",
665+
"native:refactorfields",
666+
"native:removeduplicatevertices",
667+
"native:removenullgeometries",
668+
"native:renamelayer",
669+
"native:reprojectlayer",
670+
"native:rescaleraster",
671+
"native:rotatefeatures",
672+
"native:roundrastervalues",
673+
"native:ruggednessindex",
674+
"native:savefeatures",
675+
"native:saveselectedfeatures",
676+
"native:segmentizebymaxangle",
677+
"native:segmentizebymaxdistance",
678+
"native:selectbylocation",
679+
"native:serviceareafromlayer",
680+
"native:serviceareafrompoint",
681+
"native:setlayermetadata",
682+
"native:setmetadatafields",
683+
"native:setmvalue",
684+
"native:setzvalue",
685+
"native:shortestline",
686+
"native:shortestpathlayertopoint",
687+
"native:shortestpathpointtolayer",
688+
"native:shortestpathpointtopoint",
689+
"native:simplifygeometries",
690+
"native:singlesidedbuffer",
691+
"native:slope",
692+
"native:smoothgeometry",
693+
"native:snapgeometries",
694+
"native:snappointstogrid",
695+
"native:spatialiteexecutesqlregistered",
696+
"native:splitvectorlayer",
697+
"native:splitwithlines",
698+
"native:stringconcatenation",
699+
"native:subdivide",
700+
"native:sumlinelengths",
701+
"native:surfacetopolygon",
702+
"native:swapxy",
703+
"native:symmetricaldifference",
704+
"native:taperedbuffer",
705+
"native:tilesxyzdirectory",
706+
"native:tilesxyzmbtiles",
707+
"native:transect",
708+
"native:translategeometry",
709+
"native:truncatetable",
710+
"native:union",
711+
"native:updatelayermetadata",
712+
"native:uploadgpsdata",
713+
"native:virtualrastercalc",
714+
"native:voronoipolygons",
715+
"native:wedgebuffers",
716+
"native:writevectortiles_mbtiles",
717+
"native:writevectortiles_xyz",
718+
"native:zonalhistogram",
719+
"native:zonalstatisticsfb",
720+
"qgis:advancedpythonfieldcalculator",
721+
"qgis:barplot",
722+
"qgis:boxplot",
723+
"qgis:distancematrix",
724+
"qgis:distancetonearesthublinetohub",
725+
"qgis:distancetonearesthubpoints",
726+
"qgis:eliminateselectedpolygons",
727+
"qgis:executesql",
728+
"qgis:findprojection",
729+
"qgis:generatepointspixelcentroidsalongline",
730+
"qgis:heatmapkerneldensityestimation",
731+
"qgis:hypsometriccurves",
732+
"qgis:idwinterpolation",
733+
"qgis:linestopolygons",
734+
"qgis:listuniquevalues",
735+
"qgis:meanandstandarddeviationplot",
736+
"qgis:minimumboundinggeometry",
737+
"qgis:pointsdisplacement",
738+
"qgis:polarplot",
739+
"qgis:randomextractwithinsubsets",
740+
"qgis:randompointsalongline",
741+
"qgis:randompointsinlayerbounds",
742+
"qgis:randompointsinsidepolygons",
743+
"qgis:randomselection",
744+
"qgis:randomselectionwithinsubsets",
745+
"qgis:rastercalculator",
746+
"qgis:rasterlayerhistogram",
747+
"qgis:rectanglesovalsdiamondsvariable",
748+
"qgis:regularpoints",
749+
"qgis:relief",
750+
"qgis:scatter3dplot",
751+
"qgis:selectbyattribute",
752+
"qgis:selectbyexpression",
753+
"qgis:setstyleforrasterlayer",
754+
"qgis:setstyleforvectorlayer",
755+
"qgis:statisticsbycategories",
756+
"qgis:texttofloat",
757+
"qgis:tininterpolation",
758+
"qgis:topologicalcoloring",
759+
"qgis:variabledistancebuffer",
760+
"qgis:vectorlayerhistogram",
761+
"qgis:vectorlayerscatterplot",
762+
):
763+
self.assertTrue(
764+
alg.shortDescription(),
765+
f"Algorithm {alg.id()} has not shortDescription!",
766+
)
767+
self.assertTrue(
768+
alg.shortDescription()[0].isupper(),
769+
f'Algorithm {alg.id()} shortDescription does not start with capital! "{alg.shortDescription()}"',
770+
)
771+
self.assertEqual(
772+
alg.shortDescription()[-1],
773+
".",
774+
f'Algorithm {alg.id()} shortDescription does not end with full stop "{alg.shortDescription()}"',
775+
)
776+
first_word = alg.shortDescription().split(" ")[0]
777+
self.assertEqual(
778+
first_word[-1],
779+
"s",
780+
f'Algorithm {alg.id()} shortDescription should start with a verb ending in s, eg "Combines", "Creates",... "{alg.shortDescription()}"',
781+
)
782+
self.assertFalse(
783+
"</" in alg.shortDescription(),
784+
f'Algorithm {alg.id()} shortDescription should not contain any HTML formatting "{alg.shortDescription()}"',
785+
)
786+
558787

559788
if __name__ == "__main__":
560789
nose2.main()

src/analysis/processing/qgsalgorithmcheckgeometryangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckAngleAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckAngleAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect angles smaller than a given angle" );
40+
return QObject::tr( "Detects angles smaller than a given angle." );
4141
}
4242

4343
QStringList QgsGeometryCheckAngleAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometryarea.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ QString QgsGeometryCheckAreaAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckAreaAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect polygons smaller than a given area" );
40+
return QObject::tr( "Detects polygons smaller than a given area." );
4141
}
4242

43-
4443
QStringList QgsGeometryCheckAreaAlgorithm::tags() const
4544
{
4645
return QObject::tr( "check,geometry,area" ).split( ',' );

src/analysis/processing/qgsalgorithmcheckgeometrycontained.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckContainedAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckContainedAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect features contained inside polygons from a list of polygon layers" );
40+
return QObject::tr( "Detects features contained inside polygons from a list of polygon layers." );
4141
}
4242

4343
QStringList QgsGeometryCheckContainedAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometrydangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckDangleAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckDangleAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect lines with a dangle end" );
40+
return QObject::tr( "Detects lines with a dangle end." );
4141
}
4242

4343
QStringList QgsGeometryCheckDangleAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometrydegeneratepolygon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ QString QgsGeometryCheckDegeneratePolygonAlgorithm::displayName() const
3636

3737
QString QgsGeometryCheckDegeneratePolygonAlgorithm::shortDescription() const
3838
{
39-
return QObject::tr( "Detect polygons with less than 3 points" );
39+
return QObject::tr( "Detects polygons with less than 3 points." );
4040
}
4141

4242
QStringList QgsGeometryCheckDegeneratePolygonAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometryduplicate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckDuplicateAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckDuplicateAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect duplicate geometries" );
40+
return QObject::tr( "Detects duplicate geometries." );
4141
}
4242

4343
QStringList QgsGeometryCheckDuplicateAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometryduplicatenodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckDuplicateNodesAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckDuplicateNodesAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect duplicated vertices in line and polygon geometries" );
40+
return QObject::tr( "Detects duplicated vertices in line and polygon geometries." );
4141
}
4242

4343
QStringList QgsGeometryCheckDuplicateNodesAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometryfollowboundaries.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckFollowBoundariesAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckFollowBoundariesAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect polygons that do not follow boundaries defined by a reference polygon layer" );
40+
return QObject::tr( "Detects polygons that do not follow boundaries defined by a reference polygon layer." );
4141
}
4242

4343
QStringList QgsGeometryCheckFollowBoundariesAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometrygap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckGapAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckGapAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect gaps between polygons smaller than a given area" );
40+
return QObject::tr( "Detects gaps between polygons smaller than a given area." );
4141
}
4242

4343
QStringList QgsGeometryCheckGapAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometryhole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckHoleAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckHoleAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect holes inside polygons" );
40+
return QObject::tr( "Detects holes inside polygons." );
4141
}
4242

4343
QStringList QgsGeometryCheckHoleAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometrylineintersection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckLineIntersectionAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckLineIntersectionAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect intersections between different lines" );
40+
return QObject::tr( "Detects intersections between different lines." );
4141
}
4242

4343
QStringList QgsGeometryCheckLineIntersectionAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometrylinelayerintersection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckLineLayerIntersectionAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckLineLayerIntersectionAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect lines intersecting features from another layer" );
40+
return QObject::tr( "Detects lines intersecting features from another layer." );
4141
}
4242

4343
QStringList QgsGeometryCheckLineLayerIntersectionAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometrymissingvertex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckMissingVertexAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckMissingVertexAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect missing vertices along polygon borders for topology compliance" );
40+
return QObject::tr( "Detects missing vertices along polygon borders for topology compliance." );
4141
}
4242

4343
QStringList QgsGeometryCheckMissingVertexAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometrymultipart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckMultipartAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckMultipartAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect multipart features containing only one part" );
40+
return QObject::tr( "Detects multipart features containing only one part." );
4141
}
4242

4343
QStringList QgsGeometryCheckMultipartAlgorithm::tags() const

src/analysis/processing/qgsalgorithmcheckgeometryoverlap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ QString QgsGeometryCheckOverlapAlgorithm::displayName() const
3737

3838
QString QgsGeometryCheckOverlapAlgorithm::shortDescription() const
3939
{
40-
return QObject::tr( "Detect overlaps between polygons, smaller than a given area" );
40+
return QObject::tr( "Detects overlaps between polygons smaller than a given area." );
4141
}
4242

4343
QStringList QgsGeometryCheckOverlapAlgorithm::tags() const

0 commit comments

Comments
 (0)