Skip to content

Commit

Permalink
Disable pylint rules in specific versions only
Browse files Browse the repository at this point in the history
Instead of putting rule disable comments in the code, where they have to
be understood by all versions of pylint, instead use command-line
arguments to disable rules for specific versions. This avoids the
situation where a rule is unknown in earlier versions of pylint, so the
disable comment generates and error.
  • Loading branch information
aag committed Jan 17, 2022
1 parent 746eee1 commit dce5377
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ jobs:
strategy:
matrix:
python-version: [ 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 ]
include:
- python-version: 3.6
disable: '--disable=consider-using-f-string'
- python-version: 3.7
disable: '--disable=consider-using-f-string'
- python-version: 3.8
disable: '--disable=consider-using-f-string,redundant-u-string-prefix'
- python-version: 3.9
disable: '--disable=consider-using-f-string,redundant-u-string-prefix'
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -20,7 +29,7 @@ jobs:
python -m pip install --upgrade pip
pip install pylint flake8 pytest
- name: Lint with pylint
run: pylint *.py
run: pylint ${{ matrix.disable }} *.py
- name: Lint with flake8
run: flake8 *.py
- name: Test with pytest
Expand Down
4 changes: 0 additions & 4 deletions download_trailers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# We still support Python 2, so we can't use f-strings, even though pylint
# in recent versions of Python 3 wants us to.
# pylint: disable=consider-using-f-string

import argparse
import io
import json
Expand Down

0 comments on commit dce5377

Please sign in to comment.