Skip to content

Commit

Permalink
[qa] Fix code lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ppabcd committed Nov 21, 2018
1 parent 0da2230 commit 187d6cd
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions commitCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
commit = sys.argv[2]

# Function converter from php to python
def mb_substr(s,start,length=None) :
return (s[start:(start+length)])
def mb_substr(s, start, length=None) :
return (s[start :(start + length)])


# Get Github token
Expand All @@ -31,13 +31,11 @@ def mb_substr(s,start,length=None) :
# Count Api Message when exploded
api_message_explode_count = len(api_message_explode)

errors=[]
errors = []

# Check dot in end of the first line
if api_message_explode[0][
len(
api_message_explode[0].strip()
)-1].strip() == '.' :
len(api_message_explode[0].strip()) - 1].strip() == '.' :
errors.append("Do not add a final dot at the end of the first line.")

# Check prefix
Expand Down Expand Up @@ -67,15 +65,15 @@ def mb_substr(s,start,length=None) :

search = requests.get(api +
'/search/issues?q=typetype:pr%20sha:'
+ mb_substr(commit, 0, 7) +
+ mb_substr(commit, 0, 7) +
'%20is_unmerged%20author:'
+ api_username +
+ api_username +
'&&sort=updated'
)
search_body = search.json()


if len(search_body['items']) > 0 :
if len(search_body['items']) > 0:
search_data = search_body['items'][0]['number']
response_url = "/repos/" + str(repo) + "/issues/" + str(search_data) + "/comments"

Expand All @@ -85,4 +83,4 @@ def mb_substr(s,start,length=None) :
post_fields = {
'body': body
}
review = requests.post(api + response_url,json=post_fields, headers=headers)
review = requests.post(api + response_url, json=post_fields, headers=headers)

0 comments on commit 187d6cd

Please sign in to comment.