Thread (11 messages) 11 messages, 7 authors, 2020-08-25

Re: [PATCH] dt-bindings: Whitespace clean-ups in schema files

From: Rob Herring <robh@kernel.org>
Date: 2020-08-12 23:05:28
Also in: alsa-devel, dri-devel, linux-arm-kernel, linux-clk, linux-devicetree, linux-fbdev, linux-gpio, linux-hwmon, linux-i2c, linux-iio, linux-input, linux-media, linux-mmc, linux-pm, linux-remoteproc, linux-rtc, linux-serial, linux-spi, linux-usb, lkml

On Wed, Aug 12, 2020 at 4:32 PM Joe Perches [off-list ref] wrote:
On Wed, 2020-08-12 at 14:36 -0600, Rob Herring wrote:
quoted
Clean-up incorrect indentation, extra spaces, long lines, and missing
EOF newline in schema files. Most of the clean-ups are for list
indentation which should always be 2 spaces more than the preceding
                                     ^
quoted
keyword.
keyword is the key part...
[]
quoted
diff --git a/Documentation/devicetree/bindings/arm/arm,integrator.yaml b/Documentation/devicetree/bindings/arm/arm,integrator.yaml
index 192ded470e32..f0daf990e077 100644
--- a/Documentation/devicetree/bindings/arm/arm,integrator.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,integrator.yaml
@@ -67,9 +67,9 @@ patternProperties:
       compatible:
         items:
           - enum:
-            - arm,integrator-ap-syscon
-            - arm,integrator-cp-syscon
-            - arm,integrator-sp-syscon
+              - arm,integrator-ap-syscon
+              - arm,integrator-cp-syscon
+              - arm,integrator-sp-syscon
Confused a bit here.
          - enum:
        10 spaces to dash
old line:
            - arm,integrator-ap-syscon
        12 spaces to dash
new line:
              - arm,integrator-ap-syscon
        14 spaces to dash

Is it supposed to be 2 spaces more than the preceding line
or 4 more?
If the preceding line is a list entry (i.e. starts with '-'), then
it's 4 more spaces. It's always 2 more spaces than the preceding
keyword start (aka json-schema vocabulary).

Arguably, this style is a bit inconsistent in that the '-' counts
toward as indentation of the current line, but not the preceding line.
However, I think this style is a bit less error prone and easier to
review. With the other style (always N more spaces) it's harder to
distinguish lists vs. dicts. For example, you can have something like
this:

- key:
  - foo
  - bar

- key:
    foo
    bar

- key:
  - foo
    bar

All 3 of these could be valid. Which one was intended? (Can't really
tell here, but you can with actual DT schema.)

Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help