SP2100 Limit line size could be ignored some times

Jan 10, 2012 at 10:23 AM

We have a nomenclarute for strings in the resource strings. The resource string key must be the same as the string without spaces like RSThisIsTheKeyOfAResourceString. The problem is some of them are longer than the line limit. Can be an exception for this cases?

It would be great if a line like this "ResourceStrings.RSThisIsAVeryLongLineForAResourceStringAndWillExcedTheLineLimit" doesn't show a warning.

Coordinator
Jan 10, 2012 at 6:27 PM

Hi sbaxter,

Just to make sure I understood you right.

You are OK that the following would be violated:

string message = String.Format(ResourceStrings.RSThisIsAVeryLongLine, arg1, arg2);

but want to allow:

string message = String.Format(
    ResourceStrings.RSThisIsAVeryLongLine,
    arg1,
    arg2);

(where line 2 is actually very-very long).

Did I got you right?

Best regards,
Oleg Shuruev

Jan 11, 2012 at 10:53 AM

Hi Oleg,

Exactly, the second line could be a very long line.

Regards

Scott.

Coordinator
Jan 15, 2012 at 9:50 PM

Should the following be allowed?

string message = String.Format(
    ResourceStrings.RSThisIsAVeryLongLine + "..." + "???",
    arg1,
    arg2);

In my point of view, it should not and needs to be overwritten to something like

string message = String.Format(
    ResourceStrings.RSThisIsAVeryLongLine
        + "..." + "???",
    arg1,
    arg2);

What do you think?

Best regards,
Oleg Shuruev

Jan 17, 2012 at 8:10 AM

I agree with you.

But I do not follow all the MS rules, I have a "mix" because I develop in delphi too. I cut to the new line until the end of line is reached, not in every argument, so in this case is not too important for me. Saying that I will write it like:

 

string message = String.Format(
    ResourceStrings.RSThisIsAVeryLongLongLongLongLongLine
    + "..." + "???", arg1, arg2);

Regards,
Scott

 

Coordinator
Feb 5, 2012 at 7:15 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.