Lines Matching refs:m
293 for m in clazz.methods:
294 if re.search("[A-Z]{2,}", m.name) is not None:
295 … warn(clazz, m, "S1", "Method names with acronyms should be getMtu() instead of getMTU()")
296 if re.match("[^a-z]", m.name):
297 error(clazz, m, "S1", "Method name must start with lowercase char")
315 for m in clazz.methods:
316 if not re.match("on[A-Z][a-z]*", m.name):
317 error(clazz, m, "L1", "Callback method names must be onFoo() style")
331 for m in clazz.methods:
332 if not re.match("on[A-Z][a-z]*", m.name):
333 error(clazz, m, "L1", "Listener method names must be onFoo() style")
336 m = clazz.methods[0]
337 if (m.name + "Listener").lower() != clazz.name.lower():
338 error(clazz, m, "L1", "Single listener method name must match class name")
403 methods = [ m.name for m in clazz.methods ]
423 for m in clazz.methods:
424 if "protected" in m.split:
425 error(clazz, m, "M7", "Protected methods not allowed; must be public")
476 methods = [ m.name for m in clazz.methods ]
477 for m in clazz.methods:
478 if "Callback" in m.raw:
479 if m.name.startswith("register"):
480 other = "unregister" + m.name[8:]
482 error(clazz, m, "L2", "Missing unregister method")
483 if m.name.startswith("unregister"):
484 other = "register" + m.name[10:]
486 error(clazz, m, "L2", "Missing register method")
488 if m.name.startswith("add") or m.name.startswith("remove"):
489 error(clazz, m, "L3", "Callback methods should be named register/unregister")
491 if "Listener" in m.raw:
492 if m.name.startswith("add"):
493 other = "remove" + m.name[3:]
495 error(clazz, m, "L2", "Missing remove method")
496 if m.name.startswith("remove") and not m.name.startswith("removeAll"):
497 other = "add" + m.name[6:]
499 error(clazz, m, "L2", "Missing add method")
501 if m.name.startswith("register") or m.name.startswith("unregister"):
502 error(clazz, m, "L3", "Listener methods should be named add/remove")
507 for m in clazz.methods:
508 if "synchronized" in m.split:
509 error(clazz, m, "M5", "Internal locks must not be exposed")
516 for m in clazz.methods:
517 if m.typ == "android.content.Intent":
518 if m.name.startswith("create") and m.name.endswith("Intent"):
521 … warn(clazz, m, "FW1", "Methods creating an Intent should be named createFooIntent()")
563 for m in clazz.methods:
564 if "final" in m.split: continue
565 if not re.match("on[A-Z]", m.name):
566 if "abstract" in m.split:
567 … warn(clazz, m, None, "Methods implemented by developers should be named onFoo()")
569 …warn(clazz, m, None, "If implemented by developer, should be named onFoo(); otherwise consider mar…
582 for m in clazz.methods:
583 if m.name == "build":
587 if m.name.startswith("get"): continue
588 if m.name.startswith("clear"): continue
590 if m.name.startswith("with"):
591 warn(clazz, m, None, "Builder methods names should use setFoo() style")
593 if m.name.startswith("set"):
594 if not m.typ.endswith(clazz.fullname):
595 warn(clazz, m, "M4", "Methods must return the builder object")
647 for m in clazz.methods:
648 ir = rank(m.typ)
650 warn(clazz, m, "FW6", "Method return type violates package layering")
651 for arg in m.args:
654 warn(clazz, m, "FW6", "Method argument type violates package layering")
661 def is_get(m): return len(m.args) == 0 and m.typ == "boolean" argument
662 def is_set(m): return len(m.args) == 1 and m.args[0] == "boolean" argument
664 gets = [ m for m in clazz.methods if is_get(m) ]
665 sets = [ m for m in clazz.methods if is_set(m) ]
668 for m in methods:
669 if m.name == actual:
670 … error(clazz, m, "M6", "Symmetric method for %s must be named %s" % (trigger, expected))
672 for m in clazz.methods:
673 if is_get(m):
674 if re.match("is[A-Z]", m.name):
675 target = m.name[2:]
677 error_if_exists(sets, m.name, expected, "setHas" + target)
678 elif re.match("has[A-Z]", m.name):
679 target = m.name[3:]
681 error_if_exists(sets, m.name, expected, "setIs" + target)
682 error_if_exists(sets, m.name, expected, "set" + target)
683 elif re.match("get[A-Z]", m.name):
684 target = m.name[3:]
686 error_if_exists(sets, m.name, expected, "setIs" + target)
687 error_if_exists(sets, m.name, expected, "setHas" + target)
689 if is_set(m):
690 if re.match("set[A-Z]", m.name):
691 target = m.name[3:]
693 error_if_exists(sets, m.name, expected, "is" + target)
694 error_if_exists(sets, m.name, expected, "has" + target)
703 for m in clazz.methods:
704 if m.typ in bad:
705 … error(clazz, m, "CL2", "Return type is concrete collection; must be higher-level interface")
706 for arg in m.args:
708 … error(clazz, m, "CL2", "Argument is concrete collection; must be higher-level interface")
729 for m in clazz.methods:
730 …if "throws java.lang.Exception" in m.raw or "throws java.lang.Throwable" in m.raw or "throws java.…
731 error(clazz, m, "S1", "Methods must not throw generic exceptions")
757 for m in clazz.methods:
758 if m.typ == "java.util.BitSet":
759 error(clazz, m, None, "Return type must not be heavy BitSet")
760 for arg in m.args:
762 error(clazz, m, None, "Argument type must not be heavy BitSet")
788 for m in clazz.methods:
789 if m.typ in boxed:
790 error(clazz, m, "M11", "Must avoid boxed primitives")
791 for arg in m.args:
793 error(clazz, m, "M11", "Must avoid boxed primitives")
804 for m in clazz.methods:
805 if "static" not in m.split:
818 for m in clazz.methods:
819 if "deprecated" in m.split: continue
820 overloads[m.name].append(m)
836 for m in methods:
837 common_args = common_args & cluster(m.args)
843 for m in methods:
844 sig = m.args[0:len(common_args)]
846 …warn(clazz, m, "M2", "Expected common arguments [%s] at beginning of overloaded method" % (", ".jo…
850 …error(clazz, m, "M2", "Expected consistent argument ordering between overloads: %s..." % (", ".joi…
880 for m in clazz.methods:
881 if m.name.startswith("unregister"): continue
882 if m.name.startswith("remove"): continue
883 if re.match("on[A-Z]+", m.name): continue
885 by_name[m.name].append(m)
887 for a in m.args:
889 found[m.name] = m
893 for m in by_name[f.name]:
894 if "android.os.Handler" in m.args:
903 for m in examine:
904 if len(m.args) > 1 and m.args[0] != "android.content.Context":
905 if "android.content.Context" in m.args[1:]:
906 error(clazz, m, "M3", "Context is distinct, so it must be the first argument")
912 for m in examine:
913 if "Listener" in m.name or "Callback" in m.name: continue
915 for a in m.args:
919 warn(clazz, m, "M3", "Listeners should always be at end of argument list")
1019 for m in clazz.ctors:
1020 if m.ident == test.ident: return True
1031 for m in methods:
1032 if m.ident == test.ident: return True