Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pylint from 2.6.0 to 2.7.2 #227

Merged
merged 4 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions checkmate/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@

LOG = logging.getLogger(__name__)

NAMING_CONVENTIONS = {
"ix": "ix__%(column_0_label)s",
"uq": "uq__%(table_name)s__%(column_0_name)s",
"ck": "ck__%(table_name)s__%(constraint_name)s",
"fk": "fk__%(table_name)s__%(column_0_name)s__%(referred_table_name)s",
"pk": "pk__%(table_name)s",
}


class BaseClass:
"""Functions common to all SQLAlchemy models."""
Expand All @@ -32,15 +40,7 @@ def __repr__(self):
# alembic after creation much easier. See:
# http://docs.sqlalchemy.org/en/latest/core/constraints.html#configuring-constraint-naming-conventions
cls=BaseClass,
metadata=sqlalchemy.MetaData(
naming_convention={
"ix": "ix__%(column_0_label)s",
"uq": "uq__%(table_name)s__%(column_0_name)s",
"ck": "ck__%(table_name)s__%(constraint_name)s",
"fk": "fk__%(table_name)s__%(column_0_name)s__%(referred_table_name)s",
"pk": "pk__%(table_name)s",
}
),
metadata=sqlalchemy.MetaData(naming_convention=NAMING_CONVENTIONS),
)


Expand Down Expand Up @@ -115,11 +115,11 @@ def _session(request): # pragma: no cover
@request.add_finished_callback
def close_the_sqlalchemy_session(_request): # pylint: disable=unused-variable
connections = (
session.transaction._connections # pylint:disable=protected-access,no-member
session.transaction._connections # pylint:disable=protected-access
)
if len(connections) > 1:
LOG.warning("closing an unclosed DB session")
session.close() # pylint:disable=no-member
session.close()

return session

Expand Down
15 changes: 4 additions & 11 deletions checkmate/migrations/env.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# We didn't write this, so we don't care
# pylint: disable=fixme,no-member
# pylint: disable=no-member

import os
from logging.config import fileConfig

from alembic import context
from sqlalchemy import MetaData, engine_from_config, pool

from checkmate.db import NAMING_CONVENTIONS

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
Expand All @@ -19,16 +21,7 @@
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
# FIXME: This duplicates the naming_convention in checkmate/db.py.
target_metadata = MetaData(
naming_convention={
"ix": "ix__%(column_0_label)s",
"uq": "uq__%(table_name)s__%(column_0_name)s",
"ck": "ck__%(table_name)s__%(constraint_name)s",
"fk": "fk__%(table_name)s__%(column_0_name)s__%(referred_table_name)s",
"pk": "pk__%(table_name)s",
}
)
target_metadata = MetaData(naming_convention=NAMING_CONVENTIONS)
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
Expand Down
5 changes: 2 additions & 3 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ amqp==5.0.2
# -r requirements/requirements.txt
# -r requirements/tests.txt
# kombu
astroid==2.4.2
astroid==2.5.1
# via pylint
attrs==20.3.0
# via
Expand Down Expand Up @@ -232,7 +232,7 @@ pycparser==2.20
# cffi
pydocstyle==5.1.1
# via -r requirements/lint.in
pylint==2.6.0
pylint==2.7.2
# via -r requirements/lint.in
pyparsing==2.4.7
# via
Expand Down Expand Up @@ -314,7 +314,6 @@ six==1.15.0
# via
# -r requirements/requirements.txt
# -r requirements/tests.txt
# astroid
# click-repl
# cryptography
# google-auth
Expand Down
13 changes: 13 additions & 0 deletions tests/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,16 @@ disable=bad-continuation,
[REPORTS]
output-format=colorized
score=no

[SIMILARITIES]
# Minimum lines number of a similarity.
min-similarity-lines=4

# Ignore comments when computing similarities.
ignore-comments=yes

# Ignore docstrings when computing similarities.
ignore-docstrings=yes

# Ignore imports when computing similarities.
ignore-imports=yes