Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions phpcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def should_execute(view):

for block in pref.get("extensions_to_blacklist"):
match = re.search(block, view.file_name())
if match != None:
if match is not None:
return False

return result
Expand Down Expand Up @@ -777,8 +777,8 @@ class PhpcsTogglePlugin(PhpcsTextBase):
"""Command to toggle if plugin should execute on save"""

def run(self, edit, toggle=None):
if toggle == None:
if pref.get("phpcs_execute_on_save") == True:
if toggle is None:
if pref.get("phpcs_execute_on_save"):
pref.set("phpcs_execute_on_save", False)
else:
pref.set("phpcs_execute_on_save", True)
Expand All @@ -792,7 +792,7 @@ def is_enabled(self):
return PhpcsTextBase.should_execute(self.view)

def description(self, paths=[]):
if pref.get("phpcs_execute_on_save") == True:
if pref.get("phpcs_execute_on_save"):
description = "Turn Execute On Save Off"
else:
description = "Turn Execute On Save On"
Expand All @@ -815,24 +815,18 @@ class PhpcsEventListener(sublime_plugin.EventListener):

def on_post_save(self, view):
if PhpcsTextBase.should_execute(view):
if pref.get("phpcs_execute_on_save") == True:
if pref.get("phpcs_execute_on_save"):
cmd = PhpcsCommand.instance(view)
thread = threading.Thread(
target=cmd.run, args=(view.file_name(), "on_save")
)
thread.start()

if (
pref.get("phpcs_execute_on_save") == True
and pref.get("php_cs_fixer_on_save") == True
):
if pref.get("phpcs_execute_on_save") and pref.get("php_cs_fixer_on_save"):
cmd = PhpcsCommand.instance(view)
cmd.fix_standards_errors("Fixer", view.file_name())

if (
pref.get("phpcs_execute_on_save") == True
and pref.get("phpcbf_on_save") == True
):
if pref.get("phpcs_execute_on_save") and pref.get("phpcbf_on_save"):
cmd = PhpcsCommand.instance(view)
cmd.fix_standards_errors("CodeBeautifier", view.file_name())

Expand All @@ -854,7 +848,7 @@ def on_pre_save(self, view):
debug_message(" Current: " + str(current_project_file))
debug_message(" Last Known: " + str(pref.get("project_file")))

if current_project_file == None:
if current_project_file is None:
debug_message("No project file defined, therefore skipping reload")
return

Expand Down