|
@@ -1,16 +1,16 @@
|
|
|
$ExitCode = 0
|
|
|
-# If we're on master then flake8 everything.
|
|
|
-$GitBranch = git rev-parse --abbrev-ref HEAD
|
|
|
-if ( $GitBranch -eq "master") {
|
|
|
- flake8 coderedcms testproject
|
|
|
+$GitDiff = git diff origin/master
|
|
|
+# If there is no diff between master, then flake8 everything.
|
|
|
+if ( $GitDiff -eq $null ) {
|
|
|
+ flake8 .
|
|
|
if ($LastExitCode -ne 0) { $ExitCode = $LastExitCode }
|
|
|
}
|
|
|
# Else flake8 just the diff.
|
|
|
else {
|
|
|
- git diff origin/master | flake8 --diff
|
|
|
+ Write-Output $GitDiff | flake8 --diff
|
|
|
if ($LastExitCode -ne 0) { $ExitCode = $LastExitCode }
|
|
|
# If the project_template changed, then flake8 the testproject too.
|
|
|
- $GitDiffTempl = git diff origin/master | Select-String -Pattern "^diff .*/project_template/.*"
|
|
|
+ $GitDiffTempl = Write-Output $GitDiff | Select-String -Pattern "^diff .*/project_template/.*"
|
|
|
if ( $GitDiffTempl -ne $null ) {
|
|
|
flake8 testproject
|
|
|
if ($LastExitCode -ne 0) { $ExitCode = $LastExitCode }
|