Skip to content

Commit 65a60c3

Browse files
authored
Adding spellcheck to the API docs and fix various typos found (#31)
* Adding spellcheck to the API docs and fix various typos found * fix license marking * Run spellcheck in CI job * update gitignore
1 parent 9618b8d commit 65a60c3

34 files changed

Lines changed: 410 additions & 131 deletions

.github/workflows/docs.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,21 @@ jobs:
4242
submodules: recursive
4343
- name: Set up OS
4444
run: |
45-
sudo apt-get update && sudo apt-get install -y \
46-
cmake ninja-build ruby build-essential \
47-
libssl-dev libjansson-dev \
48-
doxygen graphviz plantuml texlive texlive-latex-extra dblatex
45+
sudo rm /var/lib/man-db/auto-update
46+
sudo apt-get update
47+
sudo apt-get install -y \
48+
cmake ninja-build ruby build-essential \
49+
libssl-dev libjansson-dev \
50+
doxygen graphviz plantuml \
51+
dblatex texlive texlive-latex-extra texlive-font-utils \
52+
xmlstarlet aspell
4953
- name: Dependency build
5054
run: ./build.sh deps
5155
- name: Prep
5256
run: ./build.sh prep -DBUILD_TESTING=OFF -DTEST_MEMCHECK=OFF -DTEST_COVERAGE=OFF -DBUILD_DOCS_API=ON
5357
- name: Build
5458
run: |
55-
./build.sh --target docs-api-html docs-api-pdf
59+
./build.sh --target docs-api-html docs-api-pdf docs-api-misspelling
5660
./build.sh install --component docs-api
5761
- name: Compress
5862
working-directory: testroot/usr/share/doc/bsl

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
.pydevproject
77

88
# Build files
9-
deps/build
10-
build
11-
testroot
9+
/deps/build
10+
/build/
11+
/testroot/
12+
/venv/
1213
__pycache__
13-
/.pytest_cache/
14-
venv/
14+
.pytest_cache/
1515
mock-bpa-test/ccsds_bpsec_redbook_draft_734.5-R-2_requirements_implementation_guide.yaml

docs/api/CMakeLists.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ Institute of Technology, sponsored by the United States Government under
1919
the prime contract 80NM0018D0004 between the Caltech and NASA under
2020
subcontract 1700763.
2121
]]
22+
23+
include(GNUInstallDirs)
24+
2225
find_package(Doxygen REQUIRED)
2326

27+
find_program(XMLSTARLET_EXECUTABLE xmlstarlet)
28+
find_program(ASPELL_EXECUTABLE aspell)
29+
2430
find_program(MAKE_EXECUTABLE make)
2531
message(STATUS "Found make at ${MAKE_EXECUTABLE}")
2632
find_program(DBLATEX_EXECUTABLE dblatex)
@@ -36,12 +42,15 @@ endif(PLANTUML_JAR)
3642

3743
configure_file(Doxyfile.in Doxyfile @ONLY)
3844

45+
set(XML_COMBINE ${CMAKE_CURRENT_BINARY_DIR}/xml/combine.xslt)
46+
set(XML_INDEX ${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml)
3947
add_custom_target(
4048
docs-api-html
4149
BYPRODUCTS
4250
${CMAKE_CURRENT_BINARY_DIR}/html/index.html
4351
${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
4452
${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
53+
${XML_COMBINE} ${XML_INDEX}
4554
DEPENDS
4655
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
4756
${CMAKE_CURRENT_SOURCE_DIR}/footer.html
@@ -64,6 +73,38 @@ install(
6473
COMPONENT docs-api
6574
)
6675

76+
if(XMLSTARLET_EXECUTABLE AND ASPELL_EXECUTABLE)
77+
# spellcheck on combined XML output
78+
set(DICTIONARY_TXT "${CMAKE_CURRENT_SOURCE_DIR}/dictionary.txt")
79+
set(SPELLCHECK_XSL "${CMAKE_CURRENT_SOURCE_DIR}/spellcheck.xsl")
80+
set(MISSPELLING_TXT "misspelling.txt")
81+
add_custom_command(
82+
OUTPUT "dictionary.cwl"
83+
DEPENDS ${DICTIONARY_TXT}
84+
COMMAND cat "${DICTIONARY_TXT}" |
85+
${ASPELL_EXECUTABLE} --lang=en create master "./dictionary.cwl"
86+
)
87+
add_custom_command(
88+
OUTPUT ${MISSPELLING_TXT}
89+
DEPENDS
90+
${XML_COMBINE} ${XML_INDEX}
91+
${SPELLCHECK_XSL} "dictionary.cwl"
92+
COMMAND
93+
${XMLSTARLET_EXECUTABLE} tr "${XML_COMBINE}" "${XML_INDEX}" |
94+
${XMLSTARLET_EXECUTABLE} tr "${SPELLCHECK_XSL}" |
95+
${ASPELL_EXECUTABLE} --mode=html --lang=EN_US --extra-dicts=./dictionary.cwl list |
96+
sort | uniq > "${MISSPELLING_TXT}"
97+
)
98+
add_custom_target(
99+
docs-api-misspelling ALL
100+
DEPENDS "${MISSPELLING_TXT}"
101+
COMMAND cat "${MISSPELLING_TXT}"
102+
# success means file is present and empty
103+
COMMAND test -f "${MISSPELLING_TXT}" -a ! -s "${MISSPELLING_TXT}"
104+
COMMENT "Checking ${MISSPELLING_TXT}"
105+
)
106+
endif(XMLSTARLET_EXECUTABLE AND ASPELL_EXECUTABLE)
107+
67108
if(MAKE_EXECUTABLE AND DBLATEX_EXECUTABLE)
68109
add_custom_target(
69110
docs-api-pdf

docs/api/Developer_Guide.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Generally, functions returning `int`s indicate error codes.
4444
* A negative number ALWAYS indicates an error.
4545
* A positive number can be something else depending on context.
4646

47-
## Enums
47+
## Enumerations
4848

49-
Enums take the format of `BSL_EnumName_e` (with a typedef).
49+
Enumerations take the format of `BSL_EnumName_e` (with a typedef).
5050

5151
Variants of the enum should be "namespaced" with the enum, to manage clutter.
5252

@@ -74,7 +74,7 @@ More notes forthcoming.
7474
* A NULL pointer for almost any function argument is considered an anomaly and a programmer-error.
7575
* Note the \@nullable doxygen command to indicate whenever a parameter _may_ be NULL.
7676
* The public front-end API is more gracious to NULL arguments (returns error code). It is considered a runtime anomaly.
77-
* Code further in the backend is more `assert`-ive of NULL checks. A NULL argument here is not a runtime anomaly, but rather an indication the programmer made a mistake.
77+
* Code further in the backend performs more `assert` checking for NULL values. A NULL argument here is not a runtime anomaly, but rather an indication the programmer made a mistake.
7878
* If you are not already familiar, see the ["Billion Dollar Mistake"](https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare/).
7979
* \*Note: The `GetBlockMetadata` function does permit NULL arguments, as it only populates arguments that are requested.
8080
* \*Note: Certain functions that wrap OpenSSL functionality may also permit NULLs to be consistent with its interface.
@@ -104,7 +104,7 @@ More notes forthcoming.
104104
* Third party libraries providing containers may be more hassle and risk than they are worth.
105105

106106
#### » M\*Lib structures should not be referenced in the Frontend API
107-
* Keep M\*Lib usage to the BSL backend, and use standard/primative structs for frontend API. The frontend should not include any M\*Lib headers.
107+
* Keep M\*Lib usage to the BSL backend, and use standard/primitive structs for frontend API. The frontend should not include any M\*Lib headers.
108108

109109
# Documentation
110110

@@ -115,15 +115,14 @@ For reference, Doxygen comment blocks can contain complex markup based on a larg
115115

116116
When M*LIB macros are used to declare type-safe containers, the Doxygen inspection of the macro-expanded code should be inhibited but there should also be a explicit Doxygen block to provide explanation of the purpose of the struct and a reference to the type of its contents.
117117

118-
An example of this is below (corresponding to @ref BSL_PolicyActionIList_t).
118+
An example of this is below (corresponding to @ref BSL_SecCtxDict_t).
119119

120120
@verbatim
121-
/** @struct BSL_PolocuActionIList
122-
* An [M-I-LIST](https://github.com/P-p-H-d/mlib/blob/master/README.md#m-i-list)
123-
* of ::BSL_PolicyAction_t items.
121+
/** @struct BSL_SecCtxDict_t
122+
* Stable dict of security context descriptors (key: context id | value: descriptor struct)
124123
*/
125124
/// @cond Doxygen_Suppress
126-
M_ILIST_DEF(BSL_PolicyActionList, BSL_PolicyAction_t)
125+
DICT_DEF2(BSL_SecCtxDict, uint64_t, M_BASIC_OPLIST, BSL_SecCtxDesc_t, M_POD_OPLIST)
127126
/// @endcond
128127
@endverbatim
129128

@@ -188,7 +187,7 @@ Functions that can fail should have `int` return type and use the following comm
188187
**Zero**: Means success (unless clearly indicated otherwise in exceptional use-cases)
189188
**Positive**: Implies success, with some supplementary data. For example, a `_CreateBlock()` function, upon success, would return a positive integer containing the ID of the block just created.
190189

191-
NOTE!! This pattern is being adapted. A negative value indicates error, zero indicates succes.
190+
NOTE!! This pattern is being adapted. A negative value indicates error, zero indicates success.
192191
There may be times when there may be meaningful context associated with a positive value (e.g., number of bytes written).
193192

194193
# Structs and Functions
@@ -233,14 +232,14 @@ The precondition checks (on function parameters or on any other state generally)
233232
- [CHKVOID(cond)](@ref CHKVOID) when the function has an `void` return type
234233
- [CHKFALSE(cond)](@ref CHKFALSE) when the function has an `bool` return type
235234

236-
# Enums
235+
# Enumerations
237236

238-
Enums with explicit values must be justified with citations, for example the declarations of @ref BSL_BundleBlockTypeCode_e.
237+
Enumerations with explicit values must be justified with citations, for example the declarations of @ref BSL_BundleBlockTypeCode_e.
239238
Otherwise, they should not be given values.
240239

241-
Whenever possible, enums starting with zero should be avoided (since many variables default to zero, we want to avoid the case of matching an enum variant with an uninitialized, zeroed-out, value)
240+
Whenever possible, enum values starting with zero should be avoided (since many variables default to zero, we want to avoid the case of matching an enum variant with an uninitialized, zeroed-out, value)
242241

243-
Enums should be `typedef`-ed with a `_e` suffix.
242+
Enumerations should be `typedef`-ed with a `_e` suffix.
244243
Enum values should be full `SCREAMING_CASE` matching the name of the struct.
245244
@verbatim
246245
typedef enum {

docs/api/Doxyfile.in

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ INLINE_SIMPLE_STRUCTS = NO
452452
# types are typedef'ed and only the typedef is referenced, never the tag name.
453453
# The default value is: NO.
454454

455-
TYPEDEF_HIDES_STRUCT = NO
455+
TYPEDEF_HIDES_STRUCT = YES
456456

457457
# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
458458
# cache is used to resolve symbols given their name and scope. Since this can be
@@ -871,12 +871,10 @@ WARN_LOGFILE =
871871
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
872872
# Note: If this tag is empty the current directory is searched.
873873

874-
#INPUT = . \
875-
# "@CMAKE_SOURCE_DIR@/src" \
876-
# "@CMAKE_BINARY_DIR@/src" \
877-
# "@CMAKE_SOURCE_DIR@/test"
878874
INPUT = . \
879-
"@CMAKE_SOURCE_DIR@/src"
875+
"@CMAKE_SOURCE_DIR@/src" \
876+
"@CMAKE_BINARY_DIR@/src" \
877+
"@CMAKE_SOURCE_DIR@/test"
880878

881879
# This tag can be used to specify the character encoding of the source files
882880
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -2595,7 +2593,7 @@ DIAFILE_DIRS =
25952593
# generate a warning when it encounters a \startuml command in this case and
25962594
# will not generate output for the diagram.
25972595

2598-
PLANTUML_JAR_PATH =
2596+
PLANTUML_JAR_PATH = @PLANTUML_JAR@
25992597

26002598
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
26012599
# configuration file for plantuml.

docs/api/InterfaceSpec.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Institute of Technology, sponsored by the United States Government under
2020
the prime contract 80NM0018D0004 between the Caltech and NASA under
2121
subcontract 1700763.
2222
-->
23-
This document functions as the AMMOS MiMTAR required interface specificaiton.
23+
This document functions as the AMMOS MiMTAR required interface specification.
2424

2525
Bundle Protocol Security Library (BPSec Lib) Software Interface Specification
2626
=============================================================================
@@ -114,7 +114,7 @@ The BSL is regression-tested and targeted primarily toward a RHEL-9 platform on
114114

115115
The BSL defines a software interface written in C to maximize suitability for host applications regardless of their choice of programming language.
116116

117-
The BSL is expected to operate on a host with FIPS 140-mode enabled and SE Linux enforcing. Developers must test in this environment otherwise undefined behaviour may occur.
117+
The BSL is expected to operate on a host with FIPS 140-mode enabled and SE Linux enforcing. Developers must test in this environment otherwise undefined behavior may occur.
118118

119119

120120
## 2.2: Interface Medium and Characteristics
@@ -180,15 +180,15 @@ An example Policy Provider is included in the repository, as well as an implemen
180180
Refer to the doxygen-generated documentation in the repository for the relevant BSL initialization functions, that provision the library with the appropriate policy provider and security context.
181181

182182

183-
## 3.5: BSL Bundle Lifecycles and Workflos
183+
## 3.5: BSL Bundle Lifecycles and Workflows
184184

185185
At each of the four points of contact between the BPA and BSL, the BPA invokes the BSL, which goes on to query the security policy provider, and returns an ordered list of security operations to be performed on the bundle according to local security policy.
186186

187187
The BPA then iterates through this list calling the relevant BSL functions to perform the given security operation. These operations are of two types. The first simply verifies a given security result indicating whether it is successful or a failure reason code, and does not manipulate the Bundle in any way. The second type, indicated by “finalize” in the relevant API function names, either apply a new security Block to the bundle, modify a Block in the bundle, or strip a security block from a Bundle (following its successful verification).
188188

189189
## 3.6: Software Dependencies
190190

191-
The BSL strives to avoid excessive reliance on third-party libraries and a long software supply chain. A few third-party libraries are required, however, to: provide dynamic data structures for this C codebase; provide a unit-test driver; provide a codec for CBOR-encoded Bundle blocks; and provide implementations of cryptographic algorithms. At the time of the Critical Design Review, these third-party open-source libraries respectively are MLib, Unity, QCBOR, and OpenSSL.
191+
The BSL strives to avoid excessive reliance on third-party libraries and a long software supply chain. A few third-party libraries are required, however, to: provide dynamic data structures for this C codebase; provide a unit-test driver; provide a CODEC for CBOR-encoded Bundle blocks; and provide implementations of cryptographic algorithms. At the time of the Critical Design Review, these third-party open-source libraries respectively are MLib, Unity, QCBOR, and OpenSSL.
192192

193193
Note that specific library versions are detailed in Release Description Documents (RDD), which is produced with each release of BSL.
194194

docs/api/UserGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ digraph example {
5959
}
6060
@enddot
6161

62-
The BSL comes with a @ref frontend and a @ref backend_dyn implementation which uses heap-allocated, dynamially-sized data structures and run-time registration capabilities.
62+
The BSL comes with a @ref frontend and a @ref backend_dyn implementation which uses heap-allocated, dynamically-sized data structures and run-time registration capabilities.
6363
For a more constrained (_e.g._, flight software) environment an alternative backend could be implemented with fixed-size data containers and constant-time registry lookup algorithms.
6464

6565
Along with these libraries are also two integration extensions: an _Example Policy_ module and a _Default Security Contexts_ module.

0 commit comments

Comments
 (0)