Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-5107

Update WiredTiger Python formatting/linting standard to match MongoDB

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Backlog
    • Component/s: None
    • Labels:
      None
    • Story Points:
      5
    • Sprint:
      Storage Engines 2018-10-08

      Description

      A recent Python formatting/linting update was made to the MongoDB repo for those build and test related scripts. See the quoted announcement below for details. WiredTiger team decided to apply the same standard to the WiredTiger repo. It would be great to incorporate the format checking into a script under dist/ directory, so that it's covered by existing checking command without overhead to remember running a separate new script before committing code.

      TLDR: With the commit for SERVER-23312 we have enabled Python formatting (via yapf) and linting for all .py files under buildscripts & pytests. We have also updated the linters.
       
      If you do not create/modify Python files, there should be no impact for you. If you use scons lint, you will need to ensure that your Python environment has the latest linters. You can update the Python linters using the following commands:
      pip2 install -r pytests/requirements.txt
      pip2 install -r buildscripts/requirements.txt
      pip3 install -r buildscripts/requirements.txt
       
      If you create/modify any Python files under these directories, you will need to format & lint them before you commit. You can directly format & lint using the following commands(this will format  & lint all files):
      python buildscripts/pylinters.py fix
      python buildscripts/pylinters.py lint
       
      There are other options you can choose to use:
       
      python2 buildscripts/pylinters.py --help
      usage: pylinters.py [-h] [--yapf LINTER_YAPF] [--pylint LINTER_PYLINT]
                          [--pydocstyle LINTER_PYDOCSTYLE] [--mypy LINTER_MYPY]
                          [--linters LINTERS] [-v]
                          {lint,lint-all,lint-patch,fix} ...
       
      PyLinter frontend.
       
      optional arguments:
        -h, --help            show this help message and exit
        --yapf LINTER_YAPF    Path to linter yapf
        --pylint LINTER_PYLINT
                              Path to linter pylint
        --pydocstyle LINTER_PYDOCSTYLE
                              Path to linter pydocstyle
        --mypy LINTER_MYPY    Path to linter mypy
        --linters LINTERS     Comma separated list of filters to use, defaults to
                              'all'
        -v, --verbose         Enable verbose logging
       
      Linter subcommands:
        {lint,lint-all,lint-patch,fix}
                              sub-command help
          lint                Lint only Git files
          lint-all            Lint All files
          lint-patch          Lint the files in a patch
          fix                 Fix files if possible
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                backlog-server-storage-engines Backlog - Storage Engines Team
                Reporter:
                luke.chen Luke Chen
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: