[LLVMbugs] [Bug 14258] New: clang should check NSKeyValueCoding.h methods for key and keypath naming rules

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 4 13:22:00 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14258

             Bug #: 14258
           Summary: clang should check NSKeyValueCoding.h methods for key
                    and keypath naming rules
           Product: new-bugs
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sean at rogue-research.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Two suggestions:

(1) Due to autocompletion, copy-pasting things around, or lack of coffee, I
sometimes mix up KVC keys and keypaths. ex:

  [obj setValue:value forKey:@"selection.foo"];

that should be setValue:forKey*Path*:!

clang could warn whenever a '.' char is found in a string passed to one of the
'key' methods, and even have a fix-it directing the user to the 'keyPath'
variant.

(2) Even more generally, you could validate this requirement of the "Key-Value
Coding Programming Guide":

"Keys must use ASCII encoding, begin with a lowercase letter, and may not
contain whitespace"

I think these checks would be more useful in the compiler, not the static
analyzer.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list