← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/codecheck into lp:widelands

 


Diff comments:

> 
> === modified file 'cmake/codecheck/rules/camel_case_for_classes'
> --- cmake/codecheck/rules/camel_case_for_classes	2014-09-18 15:53:08 +0000
> +++ cmake/codecheck/rules/camel_case_for_classes	2017-07-03 13:52:43 +0000
> @@ -13,30 +13,43 @@
>        if line.count("in_port_t = uint16_t") or line.count("in_addr_t = uint32_t"):
>           continue
>  
> -      if re.match("(^\s*((class|struct)\s+((\S+_)|([a-z]\S+)).*{)|((enum)\s+((\S+_)|(([abd-z])|(c(?!lass))\S+)).*{)|((using)\s+((\S+_)|([a-z]\S+)).*=).*$)", line):
> -
> -         errors.append((fn, lineno+1, "Use CapitalLetterWithCamelCase when naming an enum class, struct, or \"using\"."))
> +      words = line.strip().split()
> +      if (len(words) < 2 or words[0] not in ["class", "struct", "enum", "using"]
> +              or words[1] == "{"):
> +         continue
> +      if words[0] == "using" and words[1] == "namespace" or words[1].startswith('std::'):
> +         continue
> +      if words[0] == "enum":
> +         if words[1] == "class":
> +            words.pop(1)
> +            if len(words) < 2:
> +               continue
> +      if words[0] in ["class", "struct", "enum"] and words[-1] != "{":
> +         continue
> +      if re.match(r"([A-Z][a-z0-9]*)+", words[1]):
> +         continue
> +      errors.append((fn, lineno+1, "Use CapitalLetterWithCamelCase when naming an enum class, struct, or \"using\"."))
>  
>     return errors
>  # /end evaluate_matches
>  
>  forbidden = [

Are these changes effectively fixing bug 1388228? :)

> -    "class my_class",
> -    "class myClass",
> -    "struct my_struct",
> -    "struct myStruct",
> -    "using my_typedef",
> -    "using myTypedef",
> -    "enum class my_enum",
> -    "enum class myEnum"
> -    "enum my_enum",
> -    "enum myEnum"
> +    "class my_class {",
> +    "class myClass {",
> +    "struct my_struct {",
> +    "struct myStruct {",
> +    "using my_typedef {",
> +    "using myTypedef {",
> +    "enum class my_enum {",
> +    "enum class myEnum {"
> +    "enum my_enum {",
> +    "enum myEnum {"
>  ]
>  
>  allowed = [
> -    "class MyClass",
> -    "struct MyStruct",
> -    "using MyTypedef",
> -    "enum class MyEnum",
> -    "enum MyEnum"
> +    "class MyClass {",
> +    "struct MyStruct {",
> +    "using MyTypedef {",
> +    "enum class MyEnum {",
> +    "enum MyEnum {"
>  ]


-- 
https://code.launchpad.net/~widelands-dev/widelands/codecheck/+merge/326647
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/codecheck into lp:widelands.


References