Skip to content

Commit

Permalink
Read scripts from script path
Browse files Browse the repository at this point in the history
All of our scripts are in the same directory, so it doesn’t make much
sense to expand the script paths on every single call.
  • Loading branch information
pluehne committed Mar 3, 2022
1 parent cd7a393 commit 90c31bd
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion updater/reports/Report.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def executeScript(self, script, stdin = None):
if not stdin:
try:
# If the script is a file, then read its content as-is into stdin
with open(script) as f:
with open(self.scriptPath(script)) as f:
stdin = f.read()
except:
# If the script is a list of strings, then escape the content and set it to stdin
Expand Down
3 changes: 1 addition & 2 deletions updater/reports/ReportAPIRequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ def name(self):
return "api-requests"

def updateDailyData(self):
self.detailedHeader, newData = self.parseData(
self.executeScript(self.scriptPath("api-requests.sh")))
self.detailedHeader, newData = self.parseData(self.executeScript("api-requests.sh"))
self.header = ["date", "API requests"]
self.data.append(
[
Expand Down
3 changes: 1 addition & 2 deletions updater/reports/ReportAPIRequestsByUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ def readData(self):
pass

def updateData(self):
self.header, self.data = self.parseData(
self.executeScript(self.scriptPath("api-requests-by-user.sh")))
self.header, self.data = self.parseData(self.executeScript("api-requests-by-user.sh"))
3 changes: 1 addition & 2 deletions updater/reports/ReportFailedWebhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ def name(self):
return "failed-webhooks"

def updateDailyData(self):
self.detailedHeader, newData = self.parseData(
self.executeScript(self.scriptPath("failed-webhooks.sh")))
self.detailedHeader, newData = self.parseData(self.executeScript("failed-webhooks.sh"))
self.header = ["date", "failed webhooks"]
self.data.append(
[
Expand Down
6 changes: 2 additions & 4 deletions updater/reports/ReportGitDownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ def name(self):
return "git-download"

def updateDailyData(self):
self.detailedHeader, newData = self.parseData(
self.executeScript(self.scriptPath("git-download.sh")))
_, sumLFSTraffic = self.parseData(
self.executeScript(self.scriptPath("git-lfs-download.sh")))
self.detailedHeader, newData = self.parseData(self.executeScript("git-download.sh"))
_, sumLFSTraffic = self.parseData(self.executeScript("git-lfs-download.sh"))
self.header = \
[
"date",
Expand Down
3 changes: 1 addition & 2 deletions updater/reports/ReportGitProtocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ def name(self):
return "git-protocol"

def updateDailyData(self):
_, items = self.parseData(
self.executeScript(self.scriptPath("git-protocol.sh")))
_, items = self.parseData(self.executeScript("git-protocol.sh"))

protocols = {}
for item in items:
Expand Down
3 changes: 1 addition & 2 deletions updater/reports/ReportGitRequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ def name(self):
return "git-requests"

def updateDailyData(self):
self.detailedHeader, newData = self.parseData(
self.executeScript(self.scriptPath("git-requests.sh")))
self.detailedHeader, newData = self.parseData(self.executeScript("git-requests.sh"))
self.header = ["date", "Git requests"]
self.data.append(
[
Expand Down
3 changes: 1 addition & 2 deletions updater/reports/ReportGitVersions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ def readData(self):
pass

def updateData(self):
self.header, self.data = self.parseData(
self.executeScript(self.scriptPath("git-versions.sh")))
self.header, self.data = self.parseData(self.executeScript("git-versions.sh"))
3 changes: 1 addition & 2 deletions updater/reports/ReportGitVersionsNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ def name(self):
return "git-versions-new"

def updateDailyData(self):
newHeader, newData = self.parseData(
self.executeScript(self.scriptPath("git-versions.sh")))
newHeader, newData = self.parseData(self.executeScript("git-versions.sh"))

self.header = ["date"] + newHeader

Expand Down
3 changes: 1 addition & 2 deletions updater/reports/ReportTokenlessAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ def name(self):
return "tokenless-authentication"

def updateDailyData(self):
self.detailedHeader, newData = self.parseData(
self.executeScript(self.scriptPath("tokenless-auth.sh")))
self.detailedHeader, newData = self.parseData(self.executeScript("tokenless-auth.sh"))
self.header = ["date", "tokenless authentications"]
self.data.append(
[
Expand Down

0 comments on commit 90c31bd

Please sign in to comment.