Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit dd446e0

Browse files
committed
Add apidoc-lint target into CI
* Made a module comment mandatory except for graphql/core. * Added apidoc-lint dependency to test, bench, apidoc, coverage goals. * Fixed current ldoc warnings. * Added ldoc installing into test, pack and coverage environments.
1 parent 95e3cf4 commit dd446e0

20 files changed

+62
-20
lines changed

Makefile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,23 @@ lint:
2323
test/*.lua \
2424
--no-redefined --no-unused-args
2525

26+
.PHONY: apidoc-lint
27+
apidoc-lint:
28+
! ldoc -d doc/apidoc-lint-tmp graphql --all -f markdown 2>&1 >/dev/null | \
29+
grep -v -e 'graphql/core.*: no module() call found; no initial doc comment$$' \
30+
-e ': contains no items$$'
31+
rm -rf doc/apidoc-lint-tmp
32+
2633
.PHONY: test
27-
test: lint
34+
test: lint apidoc-lint
2835
virtualenv -p python2.7 ./.env-2.7
2936
. ./.env-2.7/bin/activate && \
3037
pip install -r ./test-run/requirements.txt && \
3138
pip install tarantool && \
3239
cd test && ./test-run.py
3340

3441
.PHONY: bench
35-
bench: lint
42+
bench: lint apidoc-lint
3643
virtualenv -p python2.7 ./.env-2.7
3744
. ./.env-2.7/bin/activate && \
3845
pip install -r ./test-run/requirements.txt && \
@@ -51,14 +58,8 @@ pure-bench:
5158
clean:
5259
rm -rf test/var luacov.stats.out luacov.report.out
5360

54-
.PHONY: apidoc-lint
55-
apidoc-lint:
56-
! ldoc -d doc/apidoc-lint-tmp graphql --all -f markdown 2>&1 >/dev/null | \
57-
grep -v ': no module() call found; no initial doc comment$$\|: contains no items$$'
58-
rm -rf doc/apidoc-lint-tmp
59-
6061
.PHONY: apidoc
61-
apidoc:
62+
apidoc: apidoc-lint
6263
ldoc -d doc/apidoc graphql --all -f markdown
6364
# fix navigation panel width
6465
sed -i -e 's/: 14em;/: 24em;/' doc/apidoc/ldoc.css
@@ -77,7 +78,7 @@ rpm:
7778
./3rd_party/packpack/packpack
7879

7980
.PHONY: coverage
80-
coverage: lint
81+
coverage: lint apidoc-lint
8182
virtualenv -p python2.7 ./.env-2.7
8283
. ./.env-2.7/bin/activate && \
8384
pip install -r ./test-run/requirements.txt && \

graphql/accessor_general.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ local function check_deadline_clock(qcontext)
260260
end
261261

262262
--- Perform unflatten, skipping, filtering, limiting of objects. This is the
263-
--- core of the `select_internal` function.
263+
--- core of the @{prepare_select_internal} function.
264264
---
265265
--- @tparam table self accessor_general instance
266266
---
@@ -680,12 +680,13 @@ end
680680

681681
--- Insert an object.
682682
---
683-
--- Parameters are the same as for @{select_internal}.
683+
--- Parameters are the same as for @{prepare_select_internal}.
684684
---
685685
--- @treturn table list of a single object we inserted
686686
---
687-
--- We can just return the object and omit select_internal() call, because we
688-
--- forbid any filters/args that could affect the result.
687+
--- We can just return the object and omit prepare_select_internal() /
688+
--- invoke_select_internal() calls, because we forbid any filters/args that
689+
--- could affect the result.
689690
local function insert_internal(self, collection_name, from, filter, args, extra)
690691
local object = extra.extra_args.insert
691692
if object == nil then return nil end
@@ -720,7 +721,8 @@ end
720721

721722
--- Update an object.
722723
---
723-
--- Same-named parameters meaning is the same as for @{select_internal}.
724+
--- Same-named parameters meaning is the same as for
725+
--- @{prepare_select_internal}.
724726
---
725727
--- @tparam table self the data accessor instance
726728
---
@@ -757,7 +759,7 @@ end
757759

758760
--- Delete an object.
759761
---
760-
--- Corresponding parameters are the same as for @{select_internal}.
762+
--- Corresponding parameters are the same as for @{prepare_select_internal}.
761763
---
762764
--- @tparam table self
763765
---

graphql/accessor_shard_cache.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Request a data in a batch and save them to a cache.
2+
13
local json = require('json')
24
local utils = require('graphql.utils')
35
local shard = utils.optional_require('shard')

graphql/bfs_executor.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ end
491491
--- fragmentMap = fragmentMap,
492492
--- }
493493
---
494-
--- @tparam table qcontext the following options:
494+
--- @tparam table opts the following options:
495495
---
496496
--- * is_item_cache_only
497497
--- * qcontext: query-local storage for various purposes
@@ -636,6 +636,9 @@ local function filter_object(object, object_type, selections, context, opts)
636636
}
637637
end
638638

639+
--- Select fields from objects in a list, create prepared resolve functions.
640+
---
641+
--- See @{filter_object} for the API and a description.
639642
filter_object_list = function(object_list, object_type, selections, context,
640643
opts)
641644
local opts = opts or {}

graphql/convert_schema/helpers.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Auxiliary functions needed for converting schemas.
2+
13
local utils = require('graphql.utils')
24
local check = utils.check
35

graphql/convert_schema/init.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Convert an extended avro-schema (collections) to a GraphQL schema.
2+
13
local schema = require('graphql.convert_schema.schema')
24

35
local convert_schema = {}

graphql/convert_schema/schema.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--- Convert extended avro-schema (collections) to GraphQL schema.
1+
--- Convert an extended avro-schema (collections) to a GraphQL schema.
22

33
local log = require('log')
44
local core_types = require('graphql.core.types')

graphql/convert_schema/union.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
--- Convert an avro-schema union type to a GraphQL Union of InputUnion
2+
--- (non-standard) type.
3+
14
local yaml = require('yaml')
25
local core_types = require('graphql.core.types')
36
local avro_helpers = require('graphql.avro_helpers')

graphql/db_schema_helpers.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Auxiliary functions to work with extended avro-schemas (collections).
2+
13
local utils = require('graphql.utils')
24
local check = utils.check
35

graphql/error_codes.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- GraphQL module error codes.
2+
13
local error_codes = {}
24

35
error_codes.TYPE_MISMATCH = 1

graphql/expressions.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- C-style expressions parser and executor.
2+
13
local lpeg = require('lulpeg')
24
local utils = require('graphql.utils')
35

graphql/expressions/constant_propagation.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Constant propagation optimization pass.
2+
13
local expressions = require('graphql.expressions')
24

35
local constant_propagation = {}
@@ -19,7 +21,7 @@ end
1921
--- value = <...> (of any type),
2022
--- }
2123
---
22-
--- @tparam table current AST node (e.g. root node)
24+
--- @tparam table node current AST node (e.g. root node)
2325
---
2426
--- @tparam table context table of the following values:
2527
---
@@ -140,7 +142,7 @@ end
140142
--- value = <...> (of any type),
141143
--- }
142144
---
143-
--- @tparam table expression
145+
--- @tparam table expr expression
144146
---
145147
--- @tparam table context table of the following values:
146148
---

graphql/extend_ast.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Extend GraphQL query AST with compiled expressions.
2+
13
local expressions = require('graphql.expressions')
24

35
local extend_ast = {}

graphql/request_batch.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Class representing a batch of similar requests.
2+
13
local utils = require('graphql.utils')
24

35
local request_batch = {}

graphql/server/server.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Serve GraphQL requests and the GraphiQL web interface via HTTP.
2+
13
local fio = require('fio')
24
local graphql_utils = require('graphql.utils')
35
local utils = require('graphql.server.utils')

graphql/server/utils.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Auxiliary functions for graphql.server.
2+
13
local fio = require('fio')
24

35
local utils = {}

graphql/statistics.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Count various statistics about a query.
2+
13
local utils = require('graphql.utils')
24
local error_codes = require('graphql.error_codes')
35

graphql/storage.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--- Functions to be exposed from shard storage nodes.
2+
13
local log = require('log')
24
local json = require('json')
35
-- local yaml = require('yaml')

rpm/prebuild.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
set -exu # Strict shell (w/o -o pipefail)
4+
5+
sudo yum -y install lua-devel luarocks
6+
sudo luarocks install ldoc

tools/ubuntu.trusty.prepare.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ tarantoolctl rocks install shard ${SHARD_VERSION:-}
2727
tarantoolctl rocks install avro-schema ${AVRO_SCHEMA:-}
2828

2929
sudo luarocks install luacheck
30+
sudo luarocks install ldoc
3031
sudo pip install virtualenv
3132

3233
# luacov, cluacov, luacov-coveralls and dependencies

0 commit comments

Comments
 (0)