summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Kathiresan <ganesh3597@gmail.com>2021-02-16 20:19:40 +0530
committerGanesh Kathiresan <ganesh3597@gmail.com>2021-03-07 11:18:24 +0530
commit135963d9dc839456873f87e0a0d94fa37990ca9c (patch)
treeceef8795efe98ab538ecae95141044c891ebe0e8
parent8e51b5b512a284cd580fdcdfff3cfbe556f013ac (diff)
downloadnumpy-135963d9dc839456873f87e0a0d94fa37990ca9c.tar.gz
MAINT: Changed branch argument to take target branch
-rw-r--r--azure-pipelines.yml2
-rw-r--r--tools/linter.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 5b6ec71ce..c8aa5b111 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -35,7 +35,7 @@ stages:
displayName: 'Install tools'
failOnStderr: true
- script: |
- python tools/linter.py --branch origin/$(System.PullRequest.SourceBranch)
+ python tools/linter.py --branch origin/$(System.PullRequest.TargetBranch)
displayName: 'Run Lint Checks'
failOnStderr: true
# Native build is based on gcc flag `-march=native`
diff --git a/tools/linter.py b/tools/linter.py
index bd54097e3..68d869367 100644
--- a/tools/linter.py
+++ b/tools/linter.py
@@ -4,7 +4,6 @@ import subprocess
from argparse import ArgumentParser
from git import Repo, exc
-BASE_BRANCH = 'master'
CONFIG = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'lint_diff.ini',
@@ -15,6 +14,7 @@ class DiffLinter:
def __init__(self, branch):
self.branch = branch
self.repo = Repo('.')
+ self.head = self.repo.head.commit
def get_branch_diff(self, uncommitted = False):
"""
@@ -24,15 +24,15 @@ class DiffLinter:
uncommitted changes
"""
try:
- commit = self.repo.merge_base(BASE_BRANCH, self.branch)[0]
+ commit = self.repo.merge_base(self.branch, self.head)[0]
except exc.GitCommandError:
print(f"Branch with name `{self.branch}` does not exist")
sys.exit(1)
if uncommitted:
- diff = self.repo.git.diff(self.branch, '***.py')
+ diff = self.repo.git.diff(self.head, '***.py')
else:
- diff = self.repo.git.diff(commit, self.branch, '***.py')
+ diff = self.repo.git.diff(commit, self.head, '***.py')
return diff
def run_pycodestyle(self, diff):