forked from mate-academy/py-linter-formatter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Сheck Your Code Against the Following Points | ||
|
||
## Don't Repeat Yourself | ||
|
||
Make sure you don't have duplicated lines or whole blocks of code. Use your `format_linter_error` function to avoid this. | ||
|
||
Also, use the `format_single_linter_file` function to format a single file. | ||
|
||
## Code Style | ||
|
||
Use descriptive and correct variable names. | ||
|
||
Good example: | ||
|
||
```python | ||
my_dict = {"one": "a", "two": "b"} | ||
[(number + " " + letter) for (number, letter) in my_dict.items()] | ||
``` | ||
|
||
Bad example: | ||
|
||
```python | ||
my_dict = {"one": "a", "two": "b"} | ||
[(k + " " + v) for (k, v) in my_dict.items()] | ||
``` | ||
|
||
While creating a dictionary — write key-value pairs in a single row. The curly braces must be located in one of two options: open and start with the text or have a line break between the text. | ||
|
||
Good example: | ||
|
||
```python | ||
my_dict = { | ||
"greeting": "Good morning, have a nice day!", | ||
"answer": "Good morning, thanks!" | ||
} | ||
|
||
``` | ||
|
||
Also a good example: | ||
|
||
```python | ||
my_dict = {"greeting": "Good morning, have a nice day!", | ||
"answer": "Good morning, thanks!"} | ||
``` | ||
|
||
Bad example: | ||
|
||
```python | ||
my_dict = {"greeting": "Good morning, have a nice day!", | ||
"answer": "Good morning, thanks!" | ||
} | ||
``` | ||
|