Commits

Rob Madole  committed d07f583

Adding a smell for a debugger statement in Javascript

  • Participants
  • Parent commits 7d6ef2a

Comments (0)

Files changed (1)

File hgcodesmell.py

 
 # smelly patterns are tuples (regex, reason)
 print_stmt = (re.compile(r'^\+\s*print\b'), 'print statement')
+debugger_stmt = (re.compile(r'^\+\s*debugger;'), 'javascript debugger')
 zero_div = (re.compile(r'^\+\s*1/0'), 'zero division error')
 set_trace = (re.compile(r'\bpdb\.set_trace\(\)'), 'set_trace')
 vim_cmd = (re.compile(r':(w|wq|q|x)$', re.M), 'vim exit command')
 
 # the master dict maps glob patterns to a list of smelly patterns
 SMELLY_STUFF = {
+    '*.js': [debugger_stmt,],
     '*.py': [print_stmt, zero_div, set_trace],
     '*': [vim_cmd],
 }