From 33cb9b9681e6e9f9163f2bb362be422f75e4ff78 Mon Sep 17 00:00:00 2001 From: Bee <10378052+bee-san@users.noreply.github.com> Date: Thu, 10 Sep 2020 12:22:28 +0100 Subject: [PATCH] Created What to check before a pull request (markdown) --- What-to-check-before-a-pull-request.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 What-to-check-before-a-pull-request.md diff --git a/What-to-check-before-a-pull-request.md b/What-to-check-before-a-pull-request.md new file mode 100644 index 0000000..3d8e105 --- /dev/null +++ b/What-to-check-before-a-pull-request.md @@ -0,0 +1,20 @@ +# What your function returns +If your function has a chance of failing, in that failing case it should return `None`. + +If your function works on every single text (I.E. the function you are using (from an external library maybe) never fails to return) you should see to see if the input string is different from the resulting string. + +If they are, return the resulting string else return None. This is because your function would return True for every single input which would result in a mess in the Ciphey logs. + +So for example (taken from a PR): + +```python + def decode(self, ctext: T) -> Optional[U]: + ctext = ctext.replace("+", " ") + res = unquote(ctext) + return res if res != ctext else None +``` + +`unquote` will never fail, so it will always return _something_. We have had to implement our own check to see if unquote did anything, this way we can return None. + +# Dictionaries or Lists +If your code requires a dictionary or list of letters or alphabets or the likes, it should go into CipheyDists. \ No newline at end of file