KOHb
а что именно в разметке и именах не так?
Длинные строки - это основа. От этого долго уходили и уж о чём о чём, а о максимальной длине строки где только не говорится (в разных языках программирования, в разных программах).
(Хотя в новомодном Go опять вернулись к старому. И когда смотришь код на Go где-нибудь на Github'е, его надо проматывать в право, потому что он не помещается в окне.)
Вот твой код, который подан на stdin программе python3-pep8
stdin:4:1: E302 expected 2 blank lines, found 0
stdin:6:80: E501 line too long (130 > 79 characters)
stdin:8:1: E302 expected 2 blank lines, found 0
stdin:9:80: E501 line too long (107 > 79 characters)
stdin:12:1: E265 block comment should start with '# '
stdin:16:1: E265 block comment should start with '# '
stdin:17:5: E301 expected 1 blank line, found 0
stdin:17:26: E231 missing whitespace after ','
stdin:18:80: E501 line too long (101 > 79 characters)
stdin:18:83: E228 missing whitespace around modulo operator
stdin:18:93: E231 missing whitespace after ','
stdin:20:1: E265 block comment should start with '# '
stdin:23:1: E265 block comment should start with '# '
stdin:24:18: E231 missing whitespace after ','
stdin:28:28: W292 no newline at end of file
А вот python3-pylint
[guest@localhost py]$ python3-pylint telebot_script.py
No config file found, using default configuration
************* Module telebot_script
C: 6, 0: Line too long (130/80) (line-too-long)
C: 9, 0: Line too long (107/80) (line-too-long)
C: 17, 0: Exactly one space required after comma
def add_user(username,userId):
^ (bad-whitespace)
C: 18, 0: Line too long (101/80) (line-too-long)
C: 18, 0: Exactly one space required after comma
c.execute("INSERT INTO TelegramUsers (Name,TelegramID) VALUES ('%s','%s')"%(username,userId))
^ (bad-whitespace)
C: 24, 0: Exactly one space required after comma
add_user(Name,TelegramID)
^ (bad-whitespace)
C: 1, 0: Missing module docstring (missing-docstring)
F: 1, 0: Unable to import 'telebot' (import-error)
C: 3, 0: Invalid constant name "bot" (invalid-name)
E: 3,22: Undefined variable 'token' (undefined-variable)
C: 5, 0: Missing function docstring (missing-docstring)
C: 6, 4: Invalid variable name "FirstMessage" (invalid-name)
C: 8, 0: Invalid function name "HelloMessage" (invalid-name)
C: 8, 0: Missing function docstring (missing-docstring)
C: 10, 4: Invalid variable name "UserName" (invalid-name)
C: 11, 4: Invalid variable name "UserID" (invalid-name)
C: 14, 4: Invalid variable name "c" (invalid-name)
C: 17, 4: Invalid argument name "userId" (invalid-name)
C: 17, 4: Missing function docstring (missing-docstring)
C: 21, 4: Invalid variable name "Name" (invalid-name)
C: 22, 4: Invalid variable name "TelegramID" (invalid-name)
W: 15, 4: Unused variable 'row' (unused-variable)
Report
======
23 statements analysed.
Statistics by type
------------------
+---------+-------+-----------+-----------+------------+---------+
|type |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module |1 |NC |NC |0.00 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
|class |0 |NC |NC |0 |0 |
+---------+-------+-----------+-----------+------------+---------+
|method |0 |NC |NC |0 |0 |
+---------+-------+-----------+-----------+------------+---------+
|function |3 |NC |NC |0.00 |33.33 |
+---------+-------+-----------+-----------+------------+---------+
Messages by category
--------------------
+-----------+-------+---------+-----------+
|type |number |previous |difference |
+===========+=======+=========+===========+
|convention |19 |NC |NC |
+-----------+-------+---------+-----------+
|refactor |0 |NC |NC |
+-----------+-------+---------+-----------+
|warning |1 |NC |NC |
+-----------+-------+---------+-----------+
|error |1 |NC |NC |
+-----------+-------+---------+-----------+
Messages
--------
+-------------------+------------+
|message id |occurrences |
+===================+============+
|invalid-name |9 |
+-------------------+------------+
|missing-docstring |4 |
+-------------------+------------+
|line-too-long |3 |
+-------------------+------------+
|bad-whitespace |3 |
+-------------------+------------+
|unused-variable |1 |
+-------------------+------------+
|undefined-variable |1 |
+-------------------+------------+
|import-error |1 |
+-------------------+------------+
Global evaluation
-----------------
Your code has been rated at -0.87/10
Duplication
-----------
+-------------------------+------+---------+-----------+
| |now |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines |0 |NC |NC |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |NC |NC |
+-------------------------+------+---------+-----------+
Raw metrics
-----------
+----------+-------+------+---------+-----------+
|type |number |% |previous |difference |
+==========+=======+======+=========+===========+
|code |24 |82.76 |NC |NC |
+----------+-------+------+---------+-----------+
|docstring |0 |0.00 |NC |NC |
+----------+-------+------+---------+-----------+
|comment |0 |0.00 |NC |NC |
+----------+-------+------+---------+-----------+
|empty |5 |17.24 |NC |NC |
+----------+-------+------+---------+-----------+
[guest@localhost py]$
Как видно из pylint, тут имена неправильно даются переменным. Часть имён слишком короткая и неинформативная, а часть имён переменных названа по принципу, который используется только для классов.
Всё это описано в
PEP8.
Важна читаемость кода, чтобы по имени можно было сразу понять, что это переменная, а не класс, или что это константа, а не переменная. Без такого точного именования надо всё время лазить по коду и смотреть, где что объявлено, чтобы точно знать, что это. Тратится время впустую.