Preserve the filenames being reviewed when generating temp files.

Review Request #11583 — Created April 8, 2021 and updated

chipx86
ReviewBot
release-3.0.x
reviewbot

Some tools (notably Checkstyle and Rubocop) have default rules that
check the name of the file being passed to it, ensuring they meet
requirements. Given that we're passing tempfiles with auto-generated
filenames, these tests were guaranteed to fail. We were able to disable
this for Rubocop, but this was a far more annoying procedure for
Checkstyle.

To address this now and going forward, we now generate a temp directory
and place the file inside of it, preserving the original name.

This is largely transparent to tool implementations, with the exception
of Rubocop, which no longer needed the filename rule suppressed. It does
impact nearly all unit tests, as those check the command being run, but
otherwise there's no impact.

Unit tests pass on Python 2.7 and 3.x.

Summary
Preserve the filenames being reviewed when generating temp files.
Description From Last Updated

This seems unrelated.

daviddavid
Checks run (2 succeeded)
flake8 passed.
JSHint passed.
david
  1. 
      
  2. bot/reviewbot/tools/rubocop.py (Diff revision 1)
     
     
     

    This seems unrelated.

    1. Previously, we always had the value Naming/FileName at a minimum, so we could guarantee a value for --except. That's not the case now, so it has to be conditional.

  3. 
      
david
  1. Ship It!
  2. 
      
Loading...