Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-68924

Pylinters doesn't work out of the box on development workstations

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL

      There are a couple of issues with pylinters.py which would make it a bit more friendly to the developer:

      1. The error that buildscripts/pylinters.py lint-scons reports when it encounters something that needs to be fixed says:

      ubuntu@kal-virtual-workstation:~/workspace/mongo$ buildscripts/pylinters.py lint-scons
      adding module: enterprise
      ERROR: Found diff for /home/ubuntu/workspace/mongo/src/mongo/db/SConscript
      To fix formatting errors, run pylinters.py fix /home/ubuntu/workspace/mongo/src/mongo/db/SConscript
      ...
      

      There are a couple with the instructions that are provided, first it needs to say buildscripts/pylinters.py (or at least to include the path from where pylinters.py was run) and second, if I run that command I get an error that absolute paths are not supported:

      ubuntu@kal-virtual-workstation:~/workspace/mongo$ buildscripts/pylinters.py fix /home/ubuntu/workspace/mongo/src/mongo/db/SConscript
      Traceback (most recent call last):
        File "/home/ubuntu/workspace/mongo/buildscripts/pylinters.py", line 273, in <module>
          main()
        File "/home/ubuntu/workspace/mongo/buildscripts/pylinters.py", line 269, in main
          args.func(args.linters, config_dict, args.file_names)
        File "/home/ubuntu/workspace/mongo/buildscripts/pylinters.py", line 191, in fix_func
          all_file_names = git.get_files_to_check(file_names, is_interesting_file)
        File "/home/ubuntu/workspace/mongo/buildscripts/linter/git.py", line 190, in get_files_to_check
          candidates_nested = [expand_file_string(f) for f in files]
        File "/home/ubuntu/workspace/mongo/buildscripts/linter/git.py", line 190, in <listcomp>
          candidates_nested = [expand_file_string(f) for f in files]
        File "/home/ubuntu/workspace/mongo/buildscripts/linter/git.py", line 151, in expand_file_string
          return [str(glob_match.resolve()) for glob_match in current_path.glob(glob_pattern)]
        File "/home/ubuntu/workspace/mongo/buildscripts/linter/git.py", line 151, in <listcomp>
          return [str(glob_match.resolve()) for glob_match in current_path.glob(glob_pattern)]
        File "/usr/local/lib/python3.9/pathlib.py", line 1165, in glob
          raise NotImplementedError("Non-relative patterns are unsupported")
      NotImplementedError: Non-relative patterns are unsupported
      

      2. When I run pylinters.py fix with the relative path, I get the following error:

      ubuntu@kal-virtual-workstation:~/workspace/mongo$ buildscripts/pylinters.py fix src/mongo/db/SConscript
      adding module: enterprise
      Traceback (most recent call last):
        File "/home/ubuntu/workspace/mongo/buildscripts/pylinters.py", line 273, in <module>
          main()
        File "/home/ubuntu/workspace/mongo/buildscripts/pylinters.py", line 269, in main
          args.func(args.linters, config_dict, args.file_names)
        File "/home/ubuntu/workspace/mongo/buildscripts/pylinters.py", line 191, in fix_func
          all_file_names = git.get_files_to_check(file_names, is_interesting_file)
        File "/home/ubuntu/workspace/mongo/buildscripts/linter/git.py", line 199, in get_files_to_check
          raise ValueError("Globs '%s' did not find any files with glob in git." % (files))
      ValueError: Globs '['src/mongo/db/SConscript']' did not find any files with glob in git.
      

            Assignee:
            trevor.guidry@mongodb.com Trevor Guidry
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: