summaryrefslogtreecommitdiffstats
path: root/src/doc/book/ci
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/ci')
-rw-r--r--src/doc/book/ci/dictionary.txt585
-rwxr-xr-xsrc/doc/book/ci/spellcheck.sh101
-rwxr-xr-xsrc/doc/book/ci/validate.sh8
3 files changed, 694 insertions, 0 deletions
diff --git a/src/doc/book/ci/dictionary.txt b/src/doc/book/ci/dictionary.txt
new file mode 100644
index 000000000..3fe25ff52
--- /dev/null
+++ b/src/doc/book/ci/dictionary.txt
@@ -0,0 +1,585 @@
+personal_ws-1.1 en 0 utf-8
+abcabcabc
+abcd
+abcdefghijklmnopqrstuvwxyz
+adaptor
+adaptors
+AddAssign
+Addr
+adfb
+afdc
+aggregator
+AGraph
+aliasability
+alignof
+alloc
+allocator
+AlwaysEqual
+Amir
+anotherusername
+APIs
+app's
+aren
+args
+ArgumentV
+associativity
+async
+atomics
+attr
+autocompletion
+AveragedCollection
+backend
+backported
+backtrace
+backtraces
+BACKTRACE
+Backtraces
+Baz's
+benchmarking
+bioinformatics
+bitand
+BitAnd
+BitAndAssign
+bitor
+BitOr
+BitOrAssign
+bitwise
+Bitwise
+bitxor
+BitXor
+BitXorAssign
+Bjarne
+Boehm
+bool
+boolean
+Boolean
+Booleans
+Bors
+BorrowMutError
+BoxMeUp
+BTreeSet
+BufRead
+BufReader
+BuildHasher
+Cacher
+cacher
+Cagain
+callsite
+CamelCase
+cargodoc
+centric
+chacha
+ChangeColor
+ChangeColorMessage
+charset
+choo
+chXX
+chYY
+clippy
+clippy's
+cmdlet
+coercions
+combinator
+ConcreteType
+config
+Config
+confignew
+const
+consts
+constant's
+copyeditor
+couldn
+CPUs
+cratesio
+CRLF
+cryptocurrencies
+cryptographic
+cryptographically
+CStr
+CString
+ctrl
+Ctrl
+customizable
+CustomSmartPointer
+CustomSmartPointers
+data's
+DataStruct
+deallocate
+deallocated
+deallocating
+deallocation
+debuginfo
+decl
+decrementing
+deduplicate
+deduplicating
+deps
+deref
+Deref
+dereference
+Dereference
+dereferenced
+dereferences
+dereferencing
+DerefMut
+DeriveInput
+Dest
+destructor
+destructure
+destructured
+destructures
+destructuring
+Destructuring
+deterministically
+DevOps
+devtools
+didn
+Dobrý
+doccargo
+doccratesio
+DOCTYPE
+doesn
+disambiguating
+DisplayBacktrace
+DivAssign
+DraftPost
+DSTs
+ebook
+ebooks
+Edsger
+egular
+else's
+emoji
+encodings
+enum
+Enum
+enums
+enum's
+Enums
+eprintln
+Erlang
+ErrorKind
+eval
+executables
+ExitCode
+expr
+extern
+favicon
+ferris
+FFFD
+FFFF
+figcaption
+fieldname
+filename
+Filename
+filesystem
+Filesystem
+filesystem's
+filesystems
+filmmaking
+Firefox
+FnMut
+FnOnce
+formatter
+formatters
+FrenchToast
+FromIterator
+FromResidual
+frontend
+getrandom
+getter
+getters
+GGraph
+GitHub
+gitignore
+grapheme
+Grapheme
+growable
+gzip
+hardcode
+hardcoded
+hardcoding
+hasher
+hashers
+HashMap
+HashSet
+Haskell
+hasn
+HeadB
+HeadC
+HelloMacro
+helloworld
+HelloWorld
+HelloWorldName
+Hmmm
+Hoare
+Hola
+homogenous
+html
+http
+https
+hyperoptimize
+hypotheticals
+Iceburgh
+ident
+IDE
+IDEs
+IDE's
+IEEE
+impl
+implementor
+implementors
+ImportantExcerpt
+incrementing
+IndexMut
+indices
+init
+initializer
+initializers
+inline
+instantiation
+internet
+interoperate
+IntoIterator
+InvalidDigit
+invariants
+ioerror
+iokind
+ioresult
+IoResult
+iostdin
+IpAddr
+IpAddrKind
+irst
+isize
+iter
+iterator's
+JavaScript
+JoinHandle
+Kay's
+kinded
+Klabnik
+lang
+LastWriteTime
+latin
+liballoc
+libc
+libcollections
+libcore
+libpanic
+librarys
+libreoffice
+libstd
+libunwind
+lifecycle
+LimitTracker
+linter
+LLVM
+lobally
+locators
+LockResult
+login
+lookup
+loopback
+lossy
+Lukas
+lval
+macOS
+Matsakis
+mathematic
+memoization
+metadata
+Metadata
+metaprogramming
+mibbit
+Mibbit
+millis
+minigrep
+mixup
+mkdir
+MockMessenger
+modifiability
+modularity
+monomorphization
+Monomorphization
+monomorphized
+MoveMessage
+Mozilla
+mpsc
+msvc
+MulAssign
+multibyte
+multithreaded
+mutex
+mutex's
+Mutex
+mutexes
+Mutexes
+MutexGuard
+mutext
+MyBox
+myprogram
+namespace
+namespaced
+namespaces
+namespacing
+natively
+newfound
+NewJob
+NewsArticle
+NewThread
+newtype
+newtypes
+nitty
+nocapture
+nomicon
+nonadministrators
+nondeterministic
+nonequality
+nongeneric
+noplayground
+NotFound
+nsprust
+null's
+OCaml
+offsetof
+online
+OpenGL
+optimizations
+OptionalFloatingPointNumber
+OptionalNumber
+OsStr
+OsString
+other's
+otherinstall
+OtherError
+OurError
+OutlinePrint
+overloadable
+overread
+PanicPayload
+param
+parameterize
+ParseIntError
+PartialEq
+PartialOrd
+pbcopy
+PendingReview
+PendingReviewPost
+PlaceholderType
+polymorphism
+PoolCreationError
+portia
+powershell
+PowerShell
+powi
+preallocate
+preallocates
+preprocessing
+Preprocessing
+preprocessor
+PrimaryColor
+println
+priv
+proc
+proto
+pseudocode
+pthreads
+pushups
+QuitMessage
+quux
+RAII
+randcrate
+RangeFrom
+RangeTo
+RangeFull
+README
+READMEs
+rect
+recurse
+recv
+redeclaring
+Refactoring
+refactor
+refactoring
+refcell
+RefCell
+refcellt
+RefMut
+reformats
+refutability
+reimplement
+RemAssign
+repr
+representable
+request's
+resizes
+resizing
+ReturnedError
+retweet
+rewordings
+rint
+ripgrep
+runnable
+runtime
+runtimes
+Rustacean
+Rustaceans
+rUsT
+rustc
+rustdoc
+Rustonomicon
+rustfix
+rustfmt
+rustup
+sampleproject
+screenshot
+searchstring
+SecondaryColor
+SelectBox
+semver
+SemVer
+serde
+ShirtColor
+ShlAssign
+ShrAssign
+shouldn
+Simula
+siphash
+SipHash
+situps
+sizeof
+SliceIndex
+Smalltalk
+snuck
+someproject
+someusername
+SPDX
+spdx
+SpreadsheetCell
+sqrt
+stackoverflow
+startup
+StaticRef
+stderr
+stdin
+Stdin
+stdlib
+stdout
+steveklabnik's
+stringify
+Stroustrup
+Stroustrup's
+struct
+Struct
+structs
+struct's
+Structs
+StrWrap
+SubAssign
+subclasses
+subcommand
+subcommands
+subdirectories
+subdirectory
+submodule
+submodules
+Submodules
+submodule’s
+suboptimal
+subpath
+substring
+subteams
+subtree
+subtyping
+summarizable
+supertrait
+supertraits
+TcpListener
+TcpStream
+templating
+test's
+TextField
+That'd
+there'd
+ThreadPool
+threadpool
+timestamp
+Tiếng
+timeline
+tlborm
+tlsv
+TODO
+TokenStream
+toml
+TOML
+toolchain
+toolchains
+ToString
+tradeoff
+tradeoffs
+TrafficLight
+transcoding
+trpl
+tuesday
+tuple
+tuples
+turbofish
+Turon
+typeof
+TypeName
+UFCS
+unary
+Unary
+uncomment
+Uncomment
+uncommenting
+unevaluated
+Uninstalling
+uninstall
+unix
+unpopulated
+unoptimized
+UnsafeCell
+unsafety
+unsized
+unsynchronized
+Unyank
+URIs
+UsefulType
+username
+USERPROFILE
+usize
+UsState
+utils
+vals
+variable's
+variant's
+vers
+versa
+vert
+Versioning
+visualstudio
+Vlissides
+vscode
+vtable
+waitlist
+wasn
+weakt
+WeatherForecast
+WebSocket
+whitespace
+wildcard
+wildcards
+Wirth
+workflow
+workspace
+workspaces
+Workspaces
+wouldn
+writeln
+WriteMessage
+xcode
+xpression
+yyyy
+ZipImpl
diff --git a/src/doc/book/ci/spellcheck.sh b/src/doc/book/ci/spellcheck.sh
new file mode 100755
index 000000000..3d61e76a5
--- /dev/null
+++ b/src/doc/book/ci/spellcheck.sh
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+set -eu
+
+aspell --version
+
+# Checks project Markdown files for spelling mistakes.
+
+# Notes:
+
+# This script needs dictionary file ($dict_filename) with project-specific
+# valid words. If this file is missing, first invocation of a script generates
+# a file of words considered typos at the moment. User should remove real typos
+# from this file and leave only valid words. When script generates false
+# positive after source modification, new valid word should be added
+# to dictionary file.
+
+# Default mode of this script is interactive. Each source file is scanned for
+# typos. aspell opens window, suggesting fixes for each found typo. Original
+# files with errors will be backed up to files with format "filename.md.bak".
+
+# When running in CI, this script should be run in "list" mode (pass "list"
+# as first argument). In this mode script scans all files and reports found
+# errors. Exit code in this case depends on scan result:
+# 1 if any errors found,
+# 0 if all is clear.
+
+# Script skips words with length less than or equal to 3. This helps to avoid
+# some false positives.
+
+# We can consider skipping source code in markdown files (```code```) to reduce
+# rate of false positives, but then we lose ability to detect typos in code
+# comments/strings etc.
+
+shopt -s nullglob
+
+dict_filename=./ci/dictionary.txt
+markdown_sources=(./src/*.md)
+mode="check"
+
+# aspell repeatedly modifies the personal dictionary for some reason,
+# so we should use a copy of our dictionary.
+dict_path="/tmp/dictionary.txt"
+
+if [[ "$1" == "list" ]]; then
+ mode="list"
+fi
+
+# Error if running in list (CI) mode and there isn't a dictionary file;
+# creating one in CI won't do any good :(
+if [[ "$mode" == "list" && ! -f "$dict_filename" ]]; then
+ echo "No dictionary file found! A dictionary file is required in CI!"
+ exit 1
+fi
+
+if [[ ! -f "$dict_filename" ]]; then
+ # Pre-check mode: generates dictionary of words aspell consider typos.
+ # After user validates that this file contains only valid words, we can
+ # look for typos using this dictionary and some default aspell dictionary.
+ echo "Scanning files to generate dictionary file '$dict_filename'."
+ echo "Please check that it doesn't contain any misspellings."
+
+ echo "personal_ws-1.1 en 0 utf-8" > "$dict_filename"
+ cat "${markdown_sources[@]}" | aspell --ignore 3 list | sort -u >> "$dict_filename"
+elif [[ "$mode" == "list" ]]; then
+ # List (default) mode: scan all files, report errors.
+ declare -i retval=0
+
+ cp "$dict_filename" "$dict_path"
+
+ if [ ! -f $dict_path ]; then
+ retval=1
+ exit "$retval"
+ fi
+
+ for fname in "${markdown_sources[@]}"; do
+ command=$(aspell --ignore 3 --personal="$dict_path" "$mode" < "$fname")
+ if [[ -n "$command" ]]; then
+ for error in $command; do
+ # FIXME: find more correct way to get line number
+ # (ideally from aspell). Now it can make some false positives,
+ # because it is just a grep.
+ grep --with-filename --line-number --color=always "$error" "$fname"
+ done
+ retval=1
+ fi
+ done
+ exit "$retval"
+elif [[ "$mode" == "check" ]]; then
+ # Interactive mode: fix typos.
+ cp "$dict_filename" "$dict_path"
+
+ if [ ! -f $dict_path ]; then
+ retval=1
+ exit "$retval"
+ fi
+
+ for fname in "${markdown_sources[@]}"; do
+ aspell --ignore 3 --dont-backup --personal="$dict_path" "$mode" "$fname"
+ done
+fi
diff --git a/src/doc/book/ci/validate.sh b/src/doc/book/ci/validate.sh
new file mode 100755
index 000000000..9d65bc161
--- /dev/null
+++ b/src/doc/book/ci/validate.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -eu
+
+for file in src/*.md ; do
+ echo Checking references in "$file"
+ cargo run --quiet --bin link2print < "$file" > /dev/null
+done \ No newline at end of file