-
‹ Home
Contents
-
Categories
-
Tags
-
Archives
- April 2025
- March 2025
- December 2024
- November 2024
- October 2024
- August 2024
- July 2024
- September 2023
- July 2023
- May 2023
- April 2023
- March 2023
- January 2023
- November 2022
- September 2022
- July 2022
- October 2021
- November 2020
- June 2020
- May 2020
- March 2020
- July 2019
- June 2019
- May 2019
- March 2019
- January 2019
- December 2018
- November 2018
- October 2018
- August 2018
- July 2018
- June 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- August 2017
- June 2017
- April 2017
- March 2017
- January 2017
- August 2016
- July 2016
- April 2016
- March 2016
- January 2016
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- August 2012
- June 2011
- May 2011
-
RSS Feeds
-
Meta
REST in Rust
The new Wikibase REST API brings standardized and simplified querying and editing of items, properties, statements etc. to Wikibase installations, first and foremost Wikidata. Last year, Wikimedia Sverige was entertaining the idea of a grant application to Wikimedia Deutschland. Part of the proposal was for me to write a Rust crate (i.e. library) for easier access to the new REST API. The project eventually didn’t go ahead, but I had started writing the code anyway, out of personal interest. To make it more chellenging, I tried to apply industry-level coding standards to the project; most of my tools are not written with this in mind, as usually I am the only one working on them.
Now, I have an (almost) feature-complete result:
- The Rust crate
- The github repo
What about those coding standards? Well:
- 248 unit tests in the codebase, running in 0.2sec (on my machine), that are also run on every github push
- many tests mock a HTTP server to allow local testing, including simulated editing
- grcov reports >97% code coverage
- tarpaulin reports ~90% code coverage (but doesn’t see some traits being used when they are)
- cyclomatic complexity mean is 2.1 for the entire codebase, <7 everywhere (according to lizard)
- function line length is <40 lines for the entire codebase
- maintainability index median is 126.3 (original) or 73.9 (VS Code)
- scripts and instructions for calculating the code metrics are part of the repo, as it an analysis.tab file
- passes miri for all of my code (tests using some external code are deactivated for miri)
I will certainly make it a point to use the crate in both new and existing projects. I hope some of you will join me, and please feed back comments and issues on the issue tracker. Pull requests welcome!