From 0a3705b7afac5473e3f8dab49d14c8441e5ca4f6 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 14 Oct 2021 15:36:58 +0100 Subject: [PATCH] Add ql/missing-qldoc query. --- ql/src/queries/style/docs/MissingQLDoc.ql | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 ql/src/queries/style/docs/MissingQLDoc.ql diff --git a/ql/src/queries/style/docs/MissingQLDoc.ql b/ql/src/queries/style/docs/MissingQLDoc.ql new file mode 100644 index 00000000000..c7da02073a3 --- /dev/null +++ b/ql/src/queries/style/docs/MissingQLDoc.ql @@ -0,0 +1,25 @@ +/** + * @name Missing QLDoc. + * @description Library classes should have QLDoc. + * @kind problem + * @problem.severity recommendation + * @id ql/missing-qldoc + * @tags maintainability + * @precision high + */ + +import ql + +from File f, Class c +where + f = c.getLocation().getFile() and + not exists(c.getQLDoc()) and // no QLDoc + f.getExtension() = "qll" and // in a library + not c.isPrivate() and // class is public + not exists(Module m | + m.getAMember*() = c and + m.isPrivate() // modules containing the class are public + ) and + not exists(c.getAliasType()) and // class is not just an alias + not f.getParentContainer*().getBaseName().toLowerCase() = ["internal", "experimental", "test"] // exclusions +select c, "This library class should have QLDoc."