Skip to main content

pylint_flask_sqlalchemy

About

pylint_flask_sqlalchemy is a Pylint plugin for improving code analysis with Flask-SQLAlchemy.

Usage

Using a simple flask app

"""app.py"""
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name
from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/test.db"
db = SQLAlchemy(app)


class Group(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), unique=True, nullable=False)

    def __repr__(self):
        return "<User %r>" % self.username


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True, nullable=False)
    group = db.relationship(Group)

    def __repr__(self):
        return "<User %r>" % self.username

user = User(username="test")
db.session.add(user)
db.session.commit()

Without the plugin: pylint app.py

app.py:11:9: E1101: Instance of 'SQLAlchemy' has no 'Column' member (no-member)
app.py:11:19: E1101: Instance of 'SQLAlchemy' has no 'Integer' member (no-member)
app.py:12:11: E1101: Instance of 'SQLAlchemy' has no 'Column' member (no-member)
app.py:12:21: E1101: Instance of 'SQLAlchemy' has no 'String' member (no-member)
app.py:19:9: E1101: Instance of 'SQLAlchemy' has no 'Column' member (no-member)
app.py:19:19: E1101: Instance of 'SQLAlchemy' has no 'Integer' member (no-member)
app.py:20:15: E1101: Instance of 'SQLAlchemy' has no 'Column' member (no-member)
app.py:20:25: E1101: Instance of 'SQLAlchemy' has no 'String' member (no-member)
app.py:21:12: E1101: Instance of 'SQLAlchemy' has no 'relationship' member (no-member)
app.py:28:0: E1101: Instance of 'scoped_session' has no 'add' member (no-member)
app.py:29:0: E1101: Instance of 'scoped_session' has no 'commit' member (no-member)

----------------------------------------------------------------------
Your code has been rated at -18.95/10 (previous run: 10.00/10, -28.95)

😓

With pylint_flask_sqlalchemy: pylint --load-plugins pylint_flask_sqlalchemy app.py

----------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: -13.08/10, +23.08)

🥳

Installation

pip install pylint_flask_sqlalchemy

and tell pylint to --load-plugins pylint_flask_sqlalchemy when you launch it.

Changelog

Current version

New

  • Handle scoped_session has no * member.

0.1.0 (2019-07-18)

New

  • Handle scoped_session has no * member.

  • Handle scoped_session has no * member.

Changes

  • Udpate readme.

0.0.3 (2019-07-13)

Changes

  • Update readme.

0.0.2 (2019-07-13)

New

  • First draft of the plugin.

Fixes

  • Packaging.

Metadata

Release files for pylint-flask-sqlalchemy 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylint-flask-sqlalchemy 0.2.0
File Size Uploaded Provenance
pylint_flask_sqlalchemy-0.2.0.tar.gz 3.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pylint-flask-sqlalchemy 0.2.0
File Interpreter ABI Platform
pylint_flask_sqlalchemy-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / pylint_flask_sqlalchemy-0.2.0.tar.gz

Download URL pylint_flask_sqlalchemy-0.2.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8ede5baba1a465d8ba39d8383ffcf0889d7a6afeff44bd24177fcf529ba8aa81
BLAKE2b-256 checksum
How to use checksums
24b9a21c275e8859afc946559d9ff8358a95c2979e1e20733ff5a7b461e37024
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

Release files / pylint_flask_sqlalchemy-0.2.0-py3-none-any.whl

Download URL pylint_flask_sqlalchemy-0.2.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27f1fffb940adc9ac8f00ff7eb91ec39ca070c0f3bcec0d7f1c702a993d40505
BLAKE2b-256 checksum
How to use checksums
9cff0283bc8ee712a50c55d94f60d8470f74c62aeacb570eee4f674fe84560b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

Security for pylint-flask-sqlalchemy 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page