jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/388858 )

Change subject: Improve "composer fix" setting
......................................................................


Improve "composer fix" setting

It's possible "composer fix" already exists without phpcbf, so
explicitly check for that.

Change-Id: I37ca898b2335ef9f324f40e0e8d8d8557fa7864a
---
M container/thing.py
1 file changed, 15 insertions(+), 2 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified
  Jforrester: Looks good to me, but someone else must approve



diff --git a/container/thing.py b/container/thing.py
index 2aab825..58b8467 100755
--- a/container/thing.py
+++ b/container/thing.py
@@ -111,7 +111,20 @@
     else:
         phpcs_xml = 'phpcs.xml'
     added_fix = False
-    if 'fix' not in j['scripts']:
+    if 'fix' in j['scripts']:
+        if isinstance(j['scripts']['fix'], list):
+            if 'phpcbf' not in j['scripts']['fix']:
+                j['scripts']['fix'].append('phpcbf')
+                added_fix = True
+            else:
+                pass
+        else:
+            j['scripts']['fix'] = [
+                j['scripts']['fix'],
+                'phpcbf'
+            ]
+            added_fix = True
+    else:
         j['scripts']['fix'] = ['phpcbf']
         added_fix = True
     with open('composer.json', 'w') as f:
@@ -230,7 +243,7 @@
         msg += 'And moved phpcs.xml to .phpcs.xml (T177256).\n\n'
 
     if added_fix:
-        msg += 'Also added "composer fix" command.'
+        msg += 'Also added phpcbf to "composer fix" command.'
     print(msg)
     subprocess.call(['git', 'diff'])
     changed = subprocess.check_output(['git', 'status', 
'--porcelain']).decode().splitlines()

-- 
To view, visit https://gerrit.wikimedia.org/r/388858
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I37ca898b2335ef9f324f40e0e8d8d8557fa7864a
Gerrit-PatchSet: 2
Gerrit-Project: labs/libraryupgrader
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to