-
Notifications
You must be signed in to change notification settings - Fork 123
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
False positives in alembic revisions #1237
Comments
Note that the template you filled out was specifically geared towards english words and does not make sense with other forms of identifiers. It would also be good to define what an alembic revision as its not something I've ever come across. |
It seems that the issues you mentioned could also solve this, but this case has more information, so it might be easier to identify that the revision is a false positive, as the migration scripts follow a certain structure. Alembic is a tool, used along sqlalchemy, to manage database schema migrations. Basically, an alembic revision is a python script that handles the upgrade/downgrade operations of a database schema migration. The revision number or revision id is like a unique identifier of the database schema version. I think it is like an UUID or maybe some hash, not sure at all. |
Could you define that format?
The question I then have is whether this is something general enough to include built-in support for or if this should be left to user config via |
The example code I show is the structure of alembic migration scripts. Also, the scripts always have 2 functions: Here is an example provided by the documentation https://alembic.sqlalchemy.org/en/latest/tutorial.html """Add a column
Revision ID: ae1027a6acf
Revises: 1975ea83b712
Create Date: 2011-11-08 12:37:36.714947
"""
# revision identifiers, used by Alembic.
revision = 'ae1027a6acf'
down_revision = '1975ea83b712'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('account', sa.Column('last_transaction_date', sa.DateTime))
def downgrade():
op.drop_column('account', 'last_transaction_date') But it is true that maybe this is too specific, and should be left to the user to exclude these patterns. The PR to detect hashes and UUIDs might be more general. |
I was less asking about the file format as we won't deal with that but the format of each of the non-words being treated as words. For example, you mentioned the filename has a 12 digit identifier. Is it always
We do have those already but we have at least #415. Our word splitting would not catch |
The format of the non-words is the base 16 number (hash), there is no |
Sounds like this is then a duplicate of #415 and closing in favor of that. |
The linter gives a false positive in version numbers from alembic revision.
For example, the filename
daa52d289898_description.py
is corrected todata52d289898_description.py
and the revision numbers included in the file also give a false positive:
The text was updated successfully, but these errors were encountered: