Crypto-TII / CryptographicEstimators

This project gathers and standardize command line scripts to estimate the difficulty of solving hard mathematical problems related to cryptography.
https://estimators.crypto.tii.ae/
GNU General Public License v3.0
34 stars 5 forks source link

Refactor/python docstrings for sd estimator #176

Closed Dioprz closed 1 month ago

Dioprz commented 1 month ago

Description

Implementation of https://github.com/Crypto-TII/CryptographicEstimators/pull/169 for SDEstimator.

Formatting changes were made by Black.

Review process

Estimator-specific doctests

make docker-build
make docker-run
pytest --doctest-modules -n auto -vv cryptographic_estimators/SDEstimator/

Cumulative test (with all the already migrated docstrings)

make docker-pytest

Pre-approval checklist

Dioprz commented 1 month ago

@Javierverbel Thank you so much for fixing the Sonarcloud warning 💯 .

Dioprz commented 1 month ago

only small comments, mainly about the citations and if the html doc generation still works

Thank you for the careful review, @FloydZ.

Some things that are worth explaining:

With that said, I left a 👍🏻 in every comment I applied, and a 👀 in those that requires feedback or consideration based on this explanation. Resolve those that you think are good now, and ping me to address any others that are missing please.

Dioprz commented 1 month ago

Alright. Digging more in the Napoleon extension for Sphinx, I found that:

  1. It's a preparser able to translate from Google-styled docstrings to typical reST python docstrings.
  2. For this reason, we still have all the power of reST where needed.
  3. With that said, I strongly discourage the usage of reST elements where avoidable. Basically because it's usage requires to learn about how to express a mathematical expression, a table, or whatever else.
  4. Napoleon provides a good number of sections and functionalities for most use-cases (Supported sections, docstring types and some configuration options). So let's just apply the KISS principle here.
  5. I completely agree with making the exception for hyperlink references with the trailing _. I will apply the changes.
  6. @FloydZ I was using backticks for monospaced font rendering. But looking at the Sphinx documentation on the topic, single backtick usage is context-dependant. What do you think we should do with that then? (EDIT: Precisely what I'm asking for is: what we should do with references to, for example: function arguments references, short math formulas, etc?)

Nice to hear your thoughts too: @Memphisd @Javierverbel

EDIT: I'm not able to generate the docs to make tests, because some MAYO-related errors arise

Dioprz commented 1 month ago

All the actionable comments were applied in 96c10fe. My last question in the previous comment shouldn't be a blocker in case we want to merge this now; but I'm also open to new comments.

Please don't review #178 and #179 until I have implemented the same changes as here. I will ping you all when those are done.

Javierverbel commented 1 month ago

I looks good to me @Dioprz . The let's MAYO-related in the next PR docstring update, Maybe in #178

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
24 New issues
0 Accepted issues

Measures
0 Security Hotspots
68.0% Coverage on New Code
0.1% Duplication on New Code

See analysis details on SonarCloud