Skip to content

Commit

Permalink
Merge pull request #227 from Gustry/flake
Browse files Browse the repository at this point in the history
GH Action - Review the CI action about some python flake
  • Loading branch information
sumandari authored Jan 10, 2022
2 parents 29b27b4 + 5c4992e commit 3c12f2c
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 98 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,48 @@ jobs:
strategy:
matrix:
python-version:
- 3.7
- '3.7'
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Test installing development dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Checkout
uses: actions/checkout@master

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('REQUIREMENTS-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python requirements
run: pip install -r REQUIREMENTS-dev.txt

- name: Run flake8
run: flake8 --config setup.cfg

- name: Run Flake8 test
run: flake8 .
test:
runs-on: ubuntu-latest
needs:
- lint
defaults:
run:
working-directory: dockerize
steps:
- uses: actions/checkout@v2

- name: Run docker-compose build
working-directory: dockerize
run: docker-compose build

- name: Run the containers
working-directory: dockerize
run: docker-compose up -d db devweb

- name: Run Coverage test
working-directory: dockerize
run: |
cat << EOF | docker-compose exec -T devweb bash
pip install coverage
Expand All @@ -48,6 +62,7 @@ jobs:
coverage run manage.py test
coverage xml
EOF
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions REQUIREMENTS-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flake8
1 change: 1 addition & 0 deletions qgis-app/custom_haystack_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from haystack.query import SearchQuerySet
from django.conf.urls import include, url


class SearchWithRequest(SearchView):

__qualname__ = 'SearchWithRequest'
Expand Down
1 change: 0 additions & 1 deletion qgis-app/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ def middleware(request):
return response

return middleware

81 changes: 0 additions & 81 deletions qgis-app/plugins/utils/plugin_upload.py

This file was deleted.

6 changes: 3 additions & 3 deletions qgis-app/plugins/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _check_required_metadata(metadata):
Checks if required metadata are in place, raise ValidationError if not found
"""
for md in PLUGIN_REQUIRED_METADATA:
if not md in dict(metadata) or not dict(metadata)[md]:
if md not in dict(metadata) or not dict(metadata)[md]:
raise ValidationError(_('Cannot find metadata <strong>%s</strong> in metadata source <code>%s</code>.<br />For further informations about metadata, please see: <a target="_blank" href="http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/plugins.html#plugin-metadata-table">metadata documentation</a>') % (md, dict(metadata).get('metadata_source')))


Expand Down Expand Up @@ -154,11 +154,11 @@ def validator(package):
package_name = package_name[:-1]
initname = package_name + '/__init__.py'
metadataname = package_name + '/metadata.txt'
if not initname in namelist and not metadataname in namelist:
if initname not in namelist and metadataname not in namelist:
raise ValidationError(_('Cannot find __init__.py or metadata.txt in the compressed package: this does not seems a valid plugin (I searched for %s and %s)') % (initname, metadataname))

# Checks for __init__.py presence
if not initname in namelist:
if initname not in namelist:
raise ValidationError(_("Cannot find __init__.py in plugin package."))

# Checks metadata
Expand Down
90 changes: 88 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,90 @@
[flake8]
exclude = .git,*migrations*
ignore = E203,E121,E122,E123,E124,E125,E126,E127,E128,E402,W503
exclude =
.git,
.venv/,
./.venv/,
vagrant_assets,
qgis-app/*/migrations/,
qgis-app/plugins/tests/HelloWorld/,

ignore =
# indentation is not a multiple of 4
E111,
E114,
# closing bracket
E121,
E122,
E123,
E124,
E125,
E126,
E127,
E128,
E129,
# continuation line unaligned for hanging indent
E131,
# missing whitespace
E201,
E202,
E203,
E211,
E221,
E222,
E225,
E226,
E231,
# multiple whitespace
E241,
# unexpected spaces around keyword
E251,
# inline comment
E261,
E262,
# block comment
E265,
# too many leading # for block comment
E266,
# multiple spaces after keyword
E271,
# expected 2 blank lines, found 1
E301,
E302,
E303,
E305,
# multiple imports
E401,
# module not at top of file
E402,
# line too long
E501,
# bare except
E722,
# ambiguous variable name
E741,
# import not used
F401,
# shadowed by loop variable
F402,
# star imports
F403,
F404,
F405,
# dictionary key 'created_by' repeated with different values
F601,
# redefinition
F811,
# local variable not used
F841,
# trailing whitespace
W291,
# no newline at end of file
W292,
# blank line at end of file
W391,
# line break before binary operator
W503,
W504,
# invalid escape sequence
W605,

max-line-length = 79

0 comments on commit 3c12f2c

Please sign in to comment.