Menu

#532 --max-code-length not always working

open
nobody
None
2020-01-15
2020-01-15
Joe P
No

I have the input file Program.input.cs, running with the command line

astyle --max-code-length=80 --stdin=Program.input.cs --stdout=Program.output.cs

the line

    return formatterResolver.GetFormatterWithVerify<string>().Serialize(ref bytes,
is still 90 characters long, even though max-code-length is set to 80

I tried with --indent-after-parens too:

astyle --max-code-length=80 --indent-after-parens --stdin=Program.input.cs --stdout=Program.output_indent_after_parens.cs

and still get lines above the max.

Any idea? Thank you!

Program.input.cs
================

namespace Sandbox
{    
    public class CustomObject
    {
        // serialize/deserialize internal field.
        class CustomObjectFormatter : IMessagePackFormatter<CustomObject>
        {
            public int Serialize(ref byte[] bytes, int offset, CustomObject value, IFormatterResolver formatterResolver)
            {
                return formatterResolver.GetFormatterWithVerify<string>().Serialize(ref bytes, offset, value.internalId, formatterResolver);
            }

            public CustomObject Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
            {
                var id = formatterResolver.GetFormatterWithVerify<string>().Deserialize(bytes, offset, formatterResolver, out readSize);
                return new CustomObject { internalId = id };
            }
        }
    }
}


Program.output.cs
=================

namespace Sandbox
{
public class CustomObject
{
    // serialize/deserialize internal field.
    class CustomObjectFormatter : IMessagePackFormatter<CustomObject>
    {
        public int Serialize(ref byte[] bytes, int offset, CustomObject value,
                             IFormatterResolver formatterResolver)
        {
            return formatterResolver.GetFormatterWithVerify<string>().Serialize(ref bytes,
                    offset, value.internalId, formatterResolver);
        }

        public CustomObject Deserialize(byte[] bytes, int offset,
                                        IFormatterResolver formatterResolver, out int readSize)
        {
            var id = formatterResolver.GetFormatterWithVerify<string>().Deserialize(bytes,
                     offset, formatterResolver, out readSize);
            return new CustomObject { internalId = id };
        }
    }
}
}

Program.output_indent_after_parens.cs
=====================================

namespace Sandbox
{
public class CustomObject
{
    // serialize/deserialize internal field.
    class CustomObjectFormatter : IMessagePackFormatter<CustomObject>
    {
        public int Serialize(ref byte[] bytes, int offset, CustomObject value,
            IFormatterResolver formatterResolver)
        {
            return formatterResolver.GetFormatterWithVerify<string>().Serialize(ref bytes,
                    offset, value.internalId, formatterResolver);
        }

        public CustomObject Deserialize(byte[] bytes, int offset,
            IFormatterResolver formatterResolver, out int readSize)
        {
            var id = formatterResolver.GetFormatterWithVerify<string>().Deserialize(bytes,
                    offset, formatterResolver, out readSize);
            return new CustomObject { internalId = id };
        }
    }
}
}
1 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB