Skip to content

Commit

Permalink
Apply improvements from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Enrique González Paredes <[email protected]>
  • Loading branch information
DropD and egparedes authored Dec 8, 2023
1 parent dd4bf12 commit dd5271d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CODING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ We deviate from the [Google Python Style Guide][google-style-guide] only in the

### Error messages

Error messages should be written as sentences, starting with a capital letter and ending with a period (avoid exclamation marks). Try to be informative without being verbose. Code object like 'ClassNames' and 'function_names' etc should be single-quoted and so should string values used to interpolate the message.
Error messages should be written as sentences, starting with a capital letter and ending with a period (avoid exclamation marks). Try to be informative without being verbose. Code objects such as 'ClassNames' and 'function_names' should be enclosed in single quotes, and so should string values used for message interpolation.

Examples:

```python
raise ValueError(f"Invalid argument 'dimension': should be of type 'Dimension', got '{dimension.type}'.")
```

Interpolated Integer values do not need double quotes, if they are indicating an amount. Example:
Interpolated integer values do not need double quotes, if they are indicating an amount. Example:

```python
raise ValueError(f"Invalid number of arguments: expected 3 arguments, got {len(args)}.")
Expand All @@ -82,7 +82,7 @@ raise ValueError(f"Received an unexpeted number of arguments. Should receive 5 a
raise ValueError(f"Wrong number of arguments: expected 5, got {len(args)}.")

# less extreme
raise TypeError(f"Wrong argument type. Can only accept 'int's, got '{type(arg)' instead.")
raise TypeError(f"Wrong argument type. Can only accept 'int's, got '{type(arg)}' instead.")
# but can still be improved
raise TypeError(f"Wrong argument type: 'int' expected, got '{type(arg)}'")
```
Expand Down

0 comments on commit dd5271d

Please sign in to comment.