githubpylintpylintrc

Github workflow pylint: How do I disable all docstring errors warnings?


I've setup the pylint workflow on GitHub.

The is the path:

myRepo/.github/workflows/pylint.yml

I added a pylintrc file in the workflows directory with the following options:

[MESSAGES CONTROL]

disable=missing-module-docstring,
        missing-function-docstring,
        missing-class-docstring

But now the build fails, so I've done this in the wrong way.

Is it possible to add the options I have in my pylintrc file to pylint.yml?

Yaml file on Github:

name: Pylint

on: [push]
  
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10"]
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pylint
    - name: Analysing the code with pylint
      run: |
        pylint $(git ls-files '*.py')

I want to disable all docstring warnings.


Solution

  • Make sure that the pylintrc (or sometimes called .pylintrc) file is at the top level of your project.

    Theoretically pylint should be able to pick up that location by default, but if it still isn't working, pass in the argument --rcfile=pylintrc to pylint. For example:

    pylint --rcfile=pylintrc $(git ls-files '*.py')
    

    Please also ensure that the pylintrc file is formatted correctly. This page shows an intial valid configuration: https://www.getcodeflow.com/pylint-configuration.html