From f04d729d43d94a24f049187fdc43c1eb9b4dcb2a Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 18 Jun 2017 14:39:10 -0400 Subject: [PATCH] enforce spell checking on CI --- .travis.yml | 4 +-- docs/dht_rss.rst | 2 +- docs/hunspell/libtorrent.dic | 35 ++++++++++++++++++++++++++- docs/makefile | 5 ++-- docs/manual.rst | 2 +- examples/client_test.cpp | 2 +- include/libtorrent/alert_types.hpp | 4 +-- include/libtorrent/bdecode.hpp | 2 +- include/libtorrent/block_cache.hpp | 2 +- include/libtorrent/create_torrent.hpp | 2 +- include/libtorrent/extensions.hpp | 14 +++++------ include/libtorrent/file_pool.hpp | 2 +- include/libtorrent/file_storage.hpp | 6 ++--- include/libtorrent/peer_info.hpp | 2 +- include/libtorrent/session.hpp | 4 +-- include/libtorrent/session_handle.hpp | 6 ++--- include/libtorrent/sha1_hash.hpp | 2 +- include/libtorrent/torrent_info.hpp | 5 ++-- src/torrent_info.cpp | 2 +- 19 files changed, 69 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index a654344af..8b975b958 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,7 +54,7 @@ before_install: echo ''import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")'' >> /Users/travis/Library/Python/2.7/lib/python/site-packages/homebrew.pth; easy_install --user Pygments; easy_install --user aafigure; - brew install --quiet graphviz; + brew install --quiet graphviz hunspell; easy_install --user Pillow; fi' @@ -96,7 +96,7 @@ install: script: # disable invoking docutils for now, until we can have a modern version of it - cd docs - - if [[ $docs == "1" && $TRAVIS_OS_NAME == "osx" ]]; then make RST2HTML=/Users/travis/Library/Python/2.7/bin/rst2html.py AAFIGURE=echo; fi + - if [[ $docs == "1" && $TRAVIS_OS_NAME == "osx" ]]; then make spell-check RST2HTML=/Users/travis/Library/Python/2.7/bin/rst2html.py AAFIGURE=echo; fi - cd .. - cd test diff --git a/docs/dht_rss.rst b/docs/dht_rss.rst index b7af6f79b..e79512366 100644 --- a/docs/dht_rss.rst +++ b/docs/dht_rss.rst @@ -66,7 +66,7 @@ are mandatory. However, RSS items will be used as examples in this BEP:: +---------+ The ``next`` pointer is at least 20 byte ID in the DHT key space pointing to where the next -item in the list is announced. The list is terminated with an ID of all zeroes. +item in the list is announced. The list is terminated with an ID of all zeros. The ID an items is announced to is determined by the SHA1 hash of the bencoded representation of the item iteself. This contains all fields in the item, except the signature. diff --git a/docs/hunspell/libtorrent.dic b/docs/hunspell/libtorrent.dic index ff748adc3..f2c4007c8 100644 --- a/docs/hunspell/libtorrent.dic +++ b/docs/hunspell/libtorrent.dic @@ -11,12 +11,14 @@ BEP bdecode bdecoded bencode +bencoding bencoded int64 uint64 enum enums struct +structs bool realloc merkle @@ -44,7 +46,8 @@ DHT adler32 LRU UPnP -NAT-PMP +NAT +PMP Arvid Norberg RTT @@ -154,3 +157,33 @@ v4 v6 upnp x509 +process' +crc32 +mtime +fallback +accessor +utf +str +bw +trackerid +timestamp +prioritisation +filehash +len +partfile +prepended +vec +dir +ut +ih +ec +cb +cid +mj +prio +src +'put' +'mtime' +'fingerprints' +'query' +'ro' diff --git a/docs/makefile b/docs/makefile index 2501d0d59..b60d416d0 100644 --- a/docs/makefile +++ b/docs/makefile @@ -99,8 +99,9 @@ endif $(REFERENCE_TARGETS:=.rst) plain_text_out.txt:gen_reference_doc.py ../include/libtorrent/*.hpp ../include/libtorrent/kademlia/*.hpp manual.rst settings.rst stats_counters.rst python gen_reference_doc.py --plain-output -spell:plain_text_out.txt - hunspell -d hunspell/en_US -p hunspell/libtorrent.dic -l plain_text_out.txt +spell-check:plain_text_out.txt + hunspell -d hunspell/en_US -p hunspell/libtorrent.dic -l plain_text_out.txt >hunspell-report.txt + @if [ -s hunspell-report.txt ]; then echo 'spellcheck failed, fix words or add to dictionary:'; cat hunspell-report.txt; false; fi; %.epub:%.rst rst2epub --exit-status=2 $? $@ diff --git a/docs/manual.rst b/docs/manual.rst index 6ab5c2b54..3910cf41a 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -62,7 +62,7 @@ how to find out about it and what to do about it. Make sure to keep track of the paused state, the error state and the upload mode of your torrents. By default, torrents are auto-managed, which means -libtorrent will pause them, unpause them, scrape them and take them out +libtorrent will pause, resume, scrape them and take them out of upload-mode automatically. Whenever a torrent encounters a fatal error, it will be stopped, and the diff --git a/examples/client_test.cpp b/examples/client_test.cpp index dd3b70a00..67035cf18 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -1912,7 +1912,7 @@ int main(int argc, char* argv[]) "[q] quit client [m] add magnet link\n" "\n" "TORRENT ACTIONS\n" - "[p] pause/unpause selected torrent [C] toggle disk cache\n" + "[p] pause/resume selected torrent [C] toggle disk cache\n" "[s] toggle sequential download [j] force recheck\n" "[space] toggle session pause [c] clear error\n" "[v] scrape [D] delete torrent and data\n" diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 94928db34..c23012176 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -1444,7 +1444,7 @@ namespace libtorrent private: - // TODO: 2 should the alert baseclass have this object instead? + // TODO: 2 should the alert base class have this object instead? aux::stack_allocator const& m_alloc; int m_log_idx; @@ -2007,7 +2007,7 @@ namespace libtorrent virtual std::string message() const TORRENT_OVERRIDE; // the target hash of the immutable item. This must - // match the sha-1 hash of the bencoded form of ``item``. + // match the SHA-1 hash of the bencoded form of ``item``. sha1_hash target; // the data for this item diff --git a/include/libtorrent/bdecode.hpp b/include/libtorrent/bdecode.hpp index 9d29dc1ca..ba614cb9d 100644 --- a/include/libtorrent/bdecode.hpp +++ b/include/libtorrent/bdecode.hpp @@ -339,7 +339,7 @@ struct TORRENT_EXPORT bdecode_node // Swap contents. void swap(bdecode_node& n); - // pre-allocate memory for the specified numbers of tokens. This is + // preallocate memory for the specified numbers of tokens. This is // useful if you know approximately how many tokens are in the file // you are about to parse. Doing so will save realloc operations // while parsing. You should only call this on the root node, before diff --git a/include/libtorrent/block_cache.hpp b/include/libtorrent/block_cache.hpp index 265c02932..c2cf7c922 100644 --- a/include/libtorrent/block_cache.hpp +++ b/include/libtorrent/block_cache.hpp @@ -111,7 +111,7 @@ namespace libtorrent partial_hash(): offset(0) {} // the number of bytes in the piece that has been hashed int offset; - // the sha-1 context + // the SHA-1 context hasher h; }; diff --git a/include/libtorrent/create_torrent.hpp b/include/libtorrent/create_torrent.hpp index aa634d374..43c37a2d2 100644 --- a/include/libtorrent/create_torrent.hpp +++ b/include/libtorrent/create_torrent.hpp @@ -355,7 +355,7 @@ namespace libtorrent // this is used when creating a torrent. If there's // only one file there are cases where it's impossible - // to know if it should be written as a multifile torrent + // to know if it should be written as a multi-file torrent // or not. e.g. test/test there's one file and one directory // and they have the same name. bool m_multifile:1; diff --git a/include/libtorrent/extensions.hpp b/include/libtorrent/extensions.hpp index 92e4686b1..26accca57 100644 --- a/include/libtorrent/extensions.hpp +++ b/include/libtorrent/extensions.hpp @@ -312,12 +312,12 @@ namespace libtorrent // easy for plugins to do timed events, for sending messages or whatever. virtual void tick() {} - // These hooks are called when the torrent is paused and unpaused respectively. + // These hooks are called when the torrent is paused and resumed respectively. // The return value indicates if the event was handled. A return value of // ``true`` indicates that it was handled, and no other plugin after this one // will have this hook function called, and the standard handler will also not be // invoked. So, returning true effectively overrides the standard behavior of - // pause or unpause. + // pause or resume. // // Note that if you call ``pause()`` or ``resume()`` on the torrent from your // handler it will recurse back into your handler, so in order to invoke the @@ -400,16 +400,16 @@ namespace libtorrent // throwing an exception from any of the handlers (except add_handshake) // closes the connection - // this is called when the initial BT handshake is received. Returning false - // means that the other end doesn't support this extension and will remove - // it from the list of plugins. - // this is not called for web seeds + // this is called when the initial bittorrent handshake is received. + // Returning false means that the other end doesn't support this extension + // and will remove it from the list of plugins. this is not called for web + // seeds virtual bool on_handshake(char const* /*reserved_bits*/) { return true; } // called when the extension handshake from the other end is received // if this returns false, it means that this extension isn't // supported by this peer. It will result in this peer_plugin - // being removed from the peer_connection and destructed. + // being removed from the peer_connection and destructed. // this is not called for web seeds virtual bool on_extension_handshake(bdecode_node const&) { return true; } diff --git a/include/libtorrent/file_pool.hpp b/include/libtorrent/file_pool.hpp index 7d85885ec..cc9bc1a2b 100644 --- a/include/libtorrent/file_pool.hpp +++ b/include/libtorrent/file_pool.hpp @@ -144,7 +144,7 @@ namespace libtorrent }; // maps storage pointer, file index pairs to the - // lru entry for the file + // LRU entry for the file typedef std::map, lru_file_entry> file_set; file_set m_files; diff --git a/include/libtorrent/file_storage.hpp b/include/libtorrent/file_storage.hpp index c11350940..cc640991f 100644 --- a/include/libtorrent/file_storage.hpp +++ b/include/libtorrent/file_storage.hpp @@ -92,7 +92,7 @@ namespace libtorrent // the modification time of this file specified in posix time. std::time_t mtime; - // a sha-1 hash of the content of the file, or zeros, if no + // a SHA-1 hash of the content of the file, or zeros, if no // file hash was present in the torrent file. It can be used to potentially // find alternative sources for the file. sha1_hash filehash; @@ -458,7 +458,7 @@ namespace libtorrent // These functions are used to query attributes of files at // a given index. // - // The ``hash()`` is a sha-1 hash of the file, or 0 if none was + // The ``hash()`` is a SHA-1 hash of the file, or 0 if none was // provided in the torrent file. This can potentially be used to // join a bittorrent network with other file sharing networks. // @@ -634,7 +634,7 @@ namespace libtorrent // all unique paths files have. The internal_file_entry::path_index // points into this array. The paths don't include the root directory // name for multi-file torrents. The m_name field need to be - // pre-pended to these paths, and the filename of a specific file + // prepended to these paths, and the filename of a specific file // entry appended, to form full file paths std::vector m_paths; diff --git a/include/libtorrent/peer_info.hpp b/include/libtorrent/peer_info.hpp index ffa3d116a..68d7b9043 100644 --- a/include/libtorrent/peer_info.hpp +++ b/include/libtorrent/peer_info.hpp @@ -331,7 +331,7 @@ namespace libtorrent int receive_quota; // an estimated round trip time to this peer, in milliseconds. It is - // estimated by timing the the tcp ``connect()``. It may be 0 for + // estimated by timing the the TCP ``connect()``. It may be 0 for // incoming connections. int rtt; diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index 9ee3b7ab5..dd9596fd0 100644 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -166,8 +166,8 @@ namespace libtorrent // settings_pack object. Its settings will take effect before the session // starts up. // - // The ``flags`` parameter can be used to start default features (upnp & - // nat-pmp) and default plugins (ut_metadata, ut_pex and smart_ban). The + // The ``flags`` parameter can be used to start default features (UPnP & + // NAT-PMP) and default plugins (ut_metadata, ut_pex and smart_ban). The // default is to start those features. If you do not want them to start, // pass 0 as the flags parameter. session(settings_pack const& pack = settings_pack() diff --git a/include/libtorrent/session_handle.hpp b/include/libtorrent/session_handle.hpp index f17bef733..a809cdb7e 100644 --- a/include/libtorrent/session_handle.hpp +++ b/include/libtorrent/session_handle.hpp @@ -407,7 +407,7 @@ namespace libtorrent // store the given bencoded data as an immutable item in the DHT. // the returned hash is the key that is to be used to look the item - // up again. It's just the sha-1 hash of the bencoded form of the + // up again. It's just the SHA-1 hash of the bencoded form of the // structure. sha1_hash dht_put_item(entry data); @@ -444,7 +444,7 @@ namespace libtorrent // it is critical to not perform any blocking operations. Ideally not // even locking a mutex. Pass any data required for this function along // with the function object's context and make the function entirely - // self-contained. The only reason data blobs' values are computed + // self-contained. The only reason data blob's value is computed // via a function instead of just passing in the new value is to avoid // race conditions. If you want to *update* the value in the DHT, you // must first retrieve it, then modify it, then write it back. The way @@ -671,7 +671,7 @@ namespace libtorrent void set_peer_class_type_filter(peer_class_type_filter const& f); // Creates a new peer class (see peer-classes_) with the given name. The - // returned integer is the new peer class' identifier. Peer classes may + // returned integer is the new peer class identifier. Peer classes may // have the same name, so each invocation of this function creates a new // class and returns a unique identifier. // diff --git a/include/libtorrent/sha1_hash.hpp b/include/libtorrent/sha1_hash.hpp index c86e9f446..5d18b320f 100644 --- a/include/libtorrent/sha1_hash.hpp +++ b/include/libtorrent/sha1_hash.hpp @@ -121,7 +121,7 @@ namespace libtorrent char const* data() const { return reinterpret_cast(&m_number[0]); } char* data() { return reinterpret_cast(&m_number[0]); } - // set the sha1-hash to all zeroes. + // set the sha1-hash to all zeros. void clear() { std::memset(m_number, 0, size); } // return true if the sha1-hash is all zero. diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index 3227f6566..510913e8e 100644 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -352,8 +352,9 @@ namespace libtorrent file_entry file_at(int index) const { return m_files.at_deprecated(index); } #endif // TORRENT_NO_DEPRECATE - // If you need index-access to files you can use the ``num_files()`` and - // ``file_path()`` et.al. to access files using indices. + // If you need index-access to files you can use the ``num_files()`` along + // with the ``file_path()``, ``file_size()``-family of functions to access + // files using indices. int num_files() const { return m_files.num_files(); } // This function will map a piece index, a byte offset within that piece diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 7b5a2b0f0..92053c745 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -1225,7 +1225,7 @@ namespace libtorrent } TORRENT_ASSERT(!files.name().empty()); - // extract sha-1 hashes for all pieces + // extract SHA-1 hashes for all pieces // we want this division to round upwards, that's why we have the // extra addition