Sfoglia il codice sorgente

Improve github actions linting

Benjamin Gleitzman 4 anni fa
parent
commit
42b6b6280c
4 ha cambiato i file con 19 aggiunte e 20 eliminazioni
  1. 5 5
      .github/workflows/python-non-master.yml
  2. 5 5
      .github/workflows/python.yml
  3. 4 3
      fastentrypoints.py
  4. 5 7
      setup.py

+ 5 - 5
.github/workflows/python-non-master.yml

@@ -27,14 +27,14 @@ jobs:
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip
-        pip install flake8 nose
+        pip install flake8 nose pylint
         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
     - name: Lint with flake8
       run: |
-        # stop the build if there are Python syntax errors or undefined names
-        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
-        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
-        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+        flake8 . --count --show-source --statistics
+    - name: Lint with pylint
+      run: |
+        pylint howdoi *.py --rcfile=.pylintrc
     - name: Test with nose
       run: |
         nosetests

+ 5 - 5
.github/workflows/python.yml

@@ -23,14 +23,14 @@ jobs:
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip
-        pip install flake8 nose
+        pip install flake8 nose pylint
         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
     - name: Lint with flake8
       run: |
-        # stop the build if there are Python syntax errors or undefined names
-        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
-        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
-        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+        flake8 . --count --show-source --statistics
+    - name: Lint with pylint
+      run: |
+        pylint howdoi *.py --rcfile=.pylintrc
     - name: Test with nose
       run: |
         nosetests

+ 4 - 3
fastentrypoints.py

@@ -1,4 +1,6 @@
-# noqa: D300,D400
+# flake8: noqa
+# pylint: skip-file
+
 # Copyright (c) 2016, Aaron Christianson
 # All rights reserved.
 #
@@ -99,8 +101,7 @@ def main():
             manifest.seek(0)
             manifest_content = manifest.read()
             if 'include fastentrypoints.py' not in manifest_content:
-                manifest.write(('\n' if manifest_content else '') +
-                               'include fastentrypoints.py')
+                manifest.write(('\n' if manifest_content else '') + 'include fastentrypoints.py')
 
         # Insert the import statement to setup.py if not present
         with open(setup_path, 'a+') as setup:

+ 5 - 7
setup.py

@@ -1,13 +1,11 @@
 #!/usr/bin/env python
 
+import os
 from setuptools import setup, find_packages
-import fastentrypoints
+# pylint: disable=unused-import
+import fastentrypoints  # noqa: F401
+# pylint: enable=unused-import
 import howdoi
-import os
-
-def extra_dependencies():
-    import sys
-    return ['argparse'] if sys.version_info < (2, 7) else []
 
 
 def read(*names):
@@ -74,5 +72,5 @@ setup(
         'cachelib==0.1',
         'appdirs',
         'keep',
-    ] + extra_dependencies(),
+    ]
 )