Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#288 Add linter (flake8) check in CI

Merged
Ofri Masad merged 1 commits into Deci-AI:master from deci-ai:feature/SG-79-add-flake_8_linter
2 changed files with 19 additions and 1 deletions
  1. 18
    0
      .circleci/config.yml
  2. 1
    1
      scripts/flake8-config
@@ -39,6 +39,24 @@ jobs:
       - deci-common/checkout_and_skip_build:
       - deci-common/checkout_and_skip_build:
           check_version_file: true
           check_version_file: true
       - deci-common/get_persisted_version_info
       - deci-common/get_persisted_version_info
+      - when:
+          condition:
+            and:
+              - not:
+                  equal: [ develop, << pipeline.git.branch >> ]
+              - not:
+                  equal: [ staging, << pipeline.git.branch >> ]
+              - not:
+                  equal: [ master, << pipeline.git.branch >> ]
+          steps:
+            - run:
+                name: install Flake8 python linter
+                command: |
+                  pip install --user flake8
+            - run:
+                name: Lint all python files changed since develop branch
+                command: |
+                  flake8 --statistics --config scripts/flake8-config setup.py $(git diff --diff-filter ACM origin/master --name-only | grep 'py$' | grep -v 'experimental/' | grep -v 'experimental_models/')
       - run:
       - run:
           name: add requirements.txt to source code
           name: add requirements.txt to source code
           command: |
           command: |
Discard
@@ -1,5 +1,5 @@
 [flake8]
 [flake8]
-ignore = E501
+ignore = E731, C901, W504 # lambda functions, function too complex, line break after binary operator
 max-line-length = 160
 max-line-length = 160
 max-complexity = 10
 max-complexity = 10
 exclude =
 exclude =
Discard