for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import sqlite3
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
SETTINGS = {
'db_name': '',
'connection': '',
}
def set_db_name(db_name):
SETTINGS['db_name'] = db_name
SETTINGS['connection'] = sqlite3.connect(db_name)
def get_cursor():
if not SETTINGS.get('connection'):
SETTINGS
SETTINGS['connection'] = sqlite3.connect(SETTINGS['db_name'])
cursor = SETTINGS['connection'].cursor()
str
cursor
This check looks for calls to members that are non-existent. These calls will fail.
The member could have been renamed or removed.
return cursor
def db_commit():
SETTINGS['connection'].commit()
commit
def execute_sql(cursor, sql):
try:
cursor.execute(sql)
except Exception as e:
e
(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.
print('error')
print(sql)
raise e
class DataBase:
__class__
def __init__(self, name):
self.db_name = name
self.connection = sqlite3.connect(name)
self.cursor = self.connection.cursor()
self._save_settings()
def _save_settings(self):
SETTINGS['connection'] = self.connection
SETTINGS['db_name'] = self.db_name
def __del__(self):
self.connection.close()
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.