diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 08661e9c2..a3117f7cb 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -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/ diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 000000000..7f92d0168 --- /dev/null +++ b/.pylintrc @@ -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 diff --git a/Dockerfile b/Dockerfile index 349dd82b1..b3cd26e88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/bookwyrm/tests/connectors/test_openlibrary_connector.py b/bookwyrm/tests/connectors/test_openlibrary_connector.py index 69e4f847c..05ba39ab9 100644 --- a/bookwyrm/tests/connectors/test_openlibrary_connector.py +++ b/bookwyrm/tests/connectors/test_openlibrary_connector.py @@ -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) diff --git a/bookwyrm/tests/models/test_import_model.py b/bookwyrm/tests/models/test_import_model.py index 7cecfe416..d1ff209f4 100644 --- a/bookwyrm/tests/models/test_import_model.py +++ b/bookwyrm/tests/models/test_import_model.py @@ -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() diff --git a/bookwyrm/tests/views/test_status.py b/bookwyrm/tests/views/test_status.py index 355071573..0026c52b5 100644 --- a/bookwyrm/tests/views/test_status.py +++ b/bookwyrm/tests/views/test_status.py @@ -281,7 +281,7 @@ http://www.fish.com/""" result = views.status.to_markdown(text) self.assertEqual( result, - '

hi and fish.com ' "is rad

", + '

hi and fish.com is rad

', ) 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 rad" result = views.status.to_markdown(text) - self.assertEqual(result, '

hi ' "is rad

") + self.assertEqual(result, '

hi is rad

') def test_delete_status(self, mock, *_): """marks a status as deleted""" diff --git a/bw-dev b/bw-dev index 058f2639b..4dd543c0a 100755 --- a/bw-dev +++ b/bw-dev @@ -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 \ diff --git a/requirements.txt b/requirements.txt index c3bdaf757..0155782cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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