run_flake8.ps1 669 B

12345678910111213141516171819
  1. $ExitCode = 0
  2. $GitDiff = git diff origin/master
  3. # If there is no diff between master, then flake8 everything.
  4. if ( $GitDiff -eq $null ) {
  5. flake8 .
  6. if ($LastExitCode -ne 0) { $ExitCode = $LastExitCode }
  7. }
  8. # Else flake8 just the diff.
  9. else {
  10. Write-Output $GitDiff | flake8 --diff
  11. if ($LastExitCode -ne 0) { $ExitCode = $LastExitCode }
  12. # If the project_template changed, then flake8 the testproject too.
  13. $GitDiffTempl = Write-Output $GitDiff | Select-String -Pattern "^diff .*/project_template/.*"
  14. if ( $GitDiffTempl -ne $null ) {
  15. flake8 testproject
  16. if ($LastExitCode -ne 0) { $ExitCode = $LastExitCode }
  17. }
  18. }
  19. exit $ExitCode