Merge pull request #2150 from cincodenada/fix-pylint

Fix pylint config for pylint 2.14.0
This commit is contained in:
Mouse Reeve 2022-06-05 15:41:32 -07:00 committed by GitHub
commit 08231f52ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 7 deletions

View file

@ -21,8 +21,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
- name: Analysing the code with pylint
run: |
pylint bookwyrm/ --ignore=migrations --disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801
pylint bookwyrm/

6
.pylintrc Normal file
View file

@ -0,0 +1,6 @@
[MAIN]
ignore=migrations
load-plugins=pylint.extensions.no_self_use
[MESSAGES CONTROL]
disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801,C3001

View file

@ -6,6 +6,7 @@ RUN mkdir /app /app/static /app/images
WORKDIR /app
RUN apt-get update && apt-get install -y gettext libgettextpo-dev tidy && apt-get clean
COPY requirements.txt /app/
RUN pip install -r requirements.txt --no-cache-dir
RUN apt-get update && apt-get install -y gettext libgettextpo-dev tidy && apt-get clean

View file

@ -211,7 +211,7 @@ class Openlibrary(TestCase):
status=200,
)
with patch(
"bookwyrm.connectors.openlibrary.Connector." "get_authors_from_data"
"bookwyrm.connectors.openlibrary.Connector.get_authors_from_data"
) as mock:
mock.return_value = []
result = self.connector.create_edition_from_data(work, self.edition_data)

View file

@ -195,7 +195,7 @@ class ImportJob(TestCase):
) as search:
search.return_value = result
with patch(
"bookwyrm.connectors.openlibrary.Connector." "get_authors_from_data"
"bookwyrm.connectors.openlibrary.Connector.get_authors_from_data"
):
book = item.get_book_from_identifier()

View file

@ -281,7 +281,7 @@ http://www.fish.com/"""
result = views.status.to_markdown(text)
self.assertEqual(
result,
'<p><em>hi</em> and <a href="http://fish.com">fish.com</a> ' "is rad</p>",
'<p><em>hi</em> and <a href="http://fish.com">fish.com</a> is rad</p>',
)
def test_to_markdown_detect_url(self, *_):
@ -297,7 +297,7 @@ http://www.fish.com/"""
"""this is mostly handled in other places, but nonetheless"""
text = "[hi](http://fish.com) is <marquee>rad</marquee>"
result = views.status.to_markdown(text)
self.assertEqual(result, '<p><a href="http://fish.com">hi</a> ' "is rad</p>")
self.assertEqual(result, '<p><a href="http://fish.com">hi</a> is rad</p>')
def test_delete_status(self, mock, *_):
"""marks a status as deleted"""

5
bw-dev
View file

@ -140,6 +140,10 @@ case "$CMD" in
black)
docker-compose run --rm dev-tools black celerywyrm bookwyrm
;;
pylint)
# pylint depends on having the app dependencies in place, so we run it in the web container
runweb pylint bookwyrm/
;;
prettier)
docker-compose run --rm dev-tools npx prettier --write bookwyrm/static/js/*.js
;;
@ -149,6 +153,7 @@ case "$CMD" in
--config dev-tools/.stylelintrc.js
;;
formatters)
runweb pylint bookwyrm/
docker-compose run --rm dev-tools black celerywyrm bookwyrm
docker-compose run --rm dev-tools npx prettier --write bookwyrm/static/js/*.js
docker-compose run --rm dev-tools npx stylelint \

View file

@ -35,3 +35,4 @@ pytest-cov==2.10.1
pytest-env==0.6.2
pytest-xdist==2.3.0
pytidylib==0.3.2
pylint==2.14.0