i am trying to automate flake8 check in Jenkins using shell script,however the flake8 cmd returns incorrect count when compared to the one you are seeing python.
cmd in Jenkins- python3 -m flake8 |wc -l i tried adding #!/usr/bin/env python3 in the shell,but dint help.
Terminal output- python3 -m flake8 |wc -l |xargs
8
./tests/unit/test_VERSION.py:0:1: TAE001 too few type annotations (0%)
./tests/unit/test_VERSION.py:3:1: E302 expected 2 blank lines, found 1
./tests/unit/test_VERSION.py:3:19: ANN201 Missing return type annotation for public function
./tests/unit/test_VERSION.py:5:1: W391 blank line at end of file
./utility_test/__init__.py:1:1: F401 '.version.__version__' imported but unused
./utility_test/archive.py:0:1: TAE001 too few type annotations (0%)
./utility_test/archive.py:12:10: ANN001 Missing type annotation for function argument 'argv'
./utility_test/archive.py:12:20: ANN201 Missing return type annotation for public function
Jenkinsfile code-
sh """#!/bin/bash
flake8Count=python3 -m flake8 |wc -l |xargs
echo "flake8 count in this project is ${flake8Count}"
"""
**Jenkins output-**
flake8 --count --output-file flake8_count.log --exit-zero
4
+ cat flake8_count.log
./utility_test/__init__.py:1:1: F401 '.version.__version__' imported but unused
./utility_test/__init__.py:1:33: W292 no newline at end of file
./tests/unit/test_VERSION.py:3:1: E302 expected 2 blank lines, found 1
./tests/unit/test_VERSION.py:5:1: W391 blank line at end of file
Additionally , I have tried add **/.py to look for python files only.flake8 **/.py |wc -l |xargs