1- import datetime
21import os
32import re
43import subprocess
54import threading
6- import time
75import sublime
86import sublime_plugin
97import sys
@@ -103,7 +101,7 @@ def plugin_loaded():
103101
104102
105103def debug_message (msg ):
106- if pref .get ("show_debug" ) == True :
104+ if pref .get ("show_debug" ):
107105 print ("[Phpcs] " + str (msg ))
108106
109107
@@ -206,7 +204,7 @@ class Sniffer(ShellCommand):
206204 """Concrete class for PHP_CodeSniffer"""
207205
208206 def execute (self , path ):
209- if pref .get ("phpcs_sniffer_run" ) != True :
207+ if not pref .get ("phpcs_sniffer_run" ):
210208 return
211209
212210 args = self .get_executable_args ()
@@ -371,7 +369,7 @@ class MessDetector(ShellCommand):
371369 """Concrete class for PHP Mess Detector"""
372370
373371 def execute (self , path ):
374- if pref .get ("phpmd_run" ) != True :
372+ if not pref .get ("phpmd_run" ):
375373 return
376374
377375 args = []
@@ -416,7 +414,7 @@ class Linter(ShellCommand):
416414 """Content class for php -l"""
417415
418416 def execute (self , path ):
419- if pref .get ("phpcs_linter_run" ) != True :
417+ if not pref .get ("phpcs_linter_run" ):
420418 return
421419
422420 if pref .get ("phpcs_php_path" ) != "" :
@@ -434,7 +432,7 @@ def parse_report(self, args):
434432 report = self .shell_out (args )
435433 debug_message (report )
436434 line = re .search (pref .get ("phpcs_linter_regex" ), report )
437- if line != None :
435+ if line is not None :
438436 error = CheckstyleError (line .group ("line" ), line .group ("message" ))
439437 self .error_list .append (error )
440438
@@ -549,7 +547,7 @@ def generate(self):
549547 if pref .get ("phpcs_show_gutter_marks" ) or pref .get (
550548 "phpcs_outline_for_errors"
551549 ):
552- if pref .get ("phpcs_icon_scope_color" ) == None :
550+ if pref .get ("phpcs_icon_scope_color" ) is None :
553551 debug_message (
554552 "WARN: phpcs_icon_scope_color is not defined, so resorting to phpcs colour scope"
555553 )
@@ -562,7 +560,7 @@ def generate(self):
562560 outline ,
563561 )
564562
565- if pref .get ("phpcs_show_quick_panel" ) == True :
563+ if pref .get ("phpcs_show_quick_panel" ):
566564 # Skip showing the errors if we ran on save, and the option isn't set.
567565 if self .event == "on_save" and not pref .get ("phpcs_show_errors_on_save" ):
568566 return
@@ -584,7 +582,7 @@ def fix_standards_errors(self, tool, path):
584582 for fix in fixes :
585583 self .error_list .append (fix .get_message ())
586584
587- if pref .get ("php_cs_fixer_show_quick_panel" ) == True :
585+ if pref .get ("php_cs_fixer_show_quick_panel" ):
588586 self .show_quick_panel ()
589587
590588 def display_coding_standards (self ):
@@ -629,15 +627,15 @@ def get_next_error(self, line):
629627 for error in self .report :
630628 error_line = error .get_line ()
631629
632- if cache_error != None :
630+ if cache_error is not None :
633631 cache_line = cache_error .get_line ()
634632
635633 if int (error_line ) > int (current_line ) and int (error_line ) < int (
636634 cache_line
637635 ):
638636 cache_error = error
639637
640- if cache_error != None :
638+ if cache_error is not None :
641639 pt = cache_error .get_point ()
642640 self .view .sel ().clear ()
643641 self .view .sel ().add (sublime .Region (pt ))
@@ -660,7 +658,7 @@ def description(self):
660658
661659 @staticmethod
662660 def should_execute (view ):
663- if view .file_name () != None :
661+ if view .file_name () is not None :
664662 try :
665663 ext = os .path .splitext (view .file_name ())[1 ]
666664 result = ext [1 :] in pref .get ("extensions_to_execute" )
0 commit comments