Preserve the filenames being reviewed when generating temp files.

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

Information

ReviewBot
release-3.0.x

Reviewers

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 ID
Preserve the filenames being reviewed when generating temp files.
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.
f15d78738ef43d818917523f499950cc38178105
Description From Last Updated

This seems unrelated.

daviddavid
david
  1. 
      
  2. bot/reviewbot/tools/rubocop.py (Diff revision 1)
     
     
     
    Show all issues

    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. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (84a8ed5)
Loading...