Skip to content

Align warning message in console for better readability #220

@alexander-yevsyukov

Description

@alexander-yevsyukov

When building Validation with latest dependencies I got the following console output. I'm placing the screenshot with slightly shrinked IDEA app window to hightlight the matter:

Image

The text we are puttin into the console is this:

> Task :java-tests:runtime:launchTestProtoData
w: file:///Users/sanders/Projects/Spine/validation/java-tests/runtime/src/test/proto/spine/test/validation/range_option_test.proto:41:5: Unsigned integer types are not supported in Java. The Protobuf compiler uses signed integers to represent unsigned types in Java (https://protobuf.dev/programming-guides/proto3/#scalar). Operations on unsigned values rely on static utility methods from `java.lang.Integer` and `java.lang.Long` classes (https://www.baeldung.com/java-unsigned-arithmetic#the-unsigned-integer-api). Be cautious when dealing with unsigned values outside of these methods, as Java treats all primitive integers as signed.
w: file:///Users/sanders/Projects/Spine/validation/java-tests/runtime/src/test/proto/spine/test/validation/range_option_test.proto:54:5: Unsigned integer types are not supported in Java. The Protobuf compiler uses signed integers to represent unsigned types in Java (https://protobuf.dev/programming-guides/proto3/#scalar). Operations on unsigned values rely on static utility methods from `java.lang.Integer` and `java.lang.Long` classes (https://www.baeldung.com/java-unsigned-arithmetic#the-unsigned-integer-api). Be cautious when dealing with unsigned values outside of these methods, as Java treats all primitive integers as signed.

It would be better to wrap the text of one warning with proper indentation. It would make these warnings:

  1. Easier to read and understand. The user won't have to force his eyeballs travel the whole width of the screen back and forth.
  2. Easier to navigate. Indentation would form w: prefixes as bulleted items.

It should look like this:

> Task :java-tests:runtime:launchTestProtoData
w: file:///Users/sanders/Projects/Spine/validation/java-tests/runtime/src/test/proto/spine/test/validation/range_option_test.proto:41:5: Unsigned integer types are not supported in Java.
   The Protobuf compiler uses signed integers to represent unsigned types in Java.
   See: https://protobuf.dev/programming-guides/proto3/#scalar
   Operations on unsigned values rely on static utility methods from `java.lang.Integer` and `java.lang.Long` classes. 
   See: https://www.baeldung.com/java-unsigned-arithmetic#the-unsigned-integer-api
   Be cautious when dealing with unsigned values outside of these methods, as Java treats all primitive integers as signed.
w: file:///Users/sanders/Projects/Spine/validation/java-tests/runtime/src/test/proto/spine/test/validation/range_option_test.proto:54:5: Unsigned integer types are not supported in Java.
   The Protobuf compiler uses signed integers to represent unsigned types in Java.
   See: https://protobuf.dev/programming-guides/proto3/#scalar
   Operations on unsigned values rely on static utility methods from `java.lang.Integer` and `java.lang.Long` classes. 
   See: https://www.baeldung.com/java-unsigned-arithmetic#the-unsigned-integer-api
   Be cautious when dealing with unsigned values outside of these methods, as Java treats all primitive integers as signed.

Notice that I do not wrap the first line which gives the path to the file with line number and error diags. These lines can be automatically picked up by tools analysing the console output. The text which follows is auxiliary, but we need to make it easier to read and jump throught the repetitions.

We probably need to give the auxiliary piece once or twice, and them refer to it as "* Reported in details earier.", as Gradle does for repeated errors.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions