← Back to team overview

kicad-developers team mailing list archive

Re: Pcbnew display origin transforms for v6

 

On 06/05/2019 17:51, Reece R. Pollack wrote:
John,

I've already jumped to clang-format 6.0, which is one of the optional installs for Mint 18. That works, once you get all the symlinks fixed,

Good to know, thanks for the update.

except it keeps wanting to reformat my switch statements like this, which is contrary to the KiCad coding standards:

@@ -148,15 +130,9 @@ int PCB_ORIGIN_TRANSFORM_Y_ABS::FromDisplay( int aValue ) const
      case ORIGIN_REFERENCE_PAGE:
          // No-op
          break;
-    case ORIGIN_REFERENCE_AUX:
-        origin = m_PcbBaseFrame->GetAuxOrigin().y;
-        break;
-    case ORIGIN_REFERENCE_GRID:
-        origin = m_PcbBaseFrame->GetGridOrigin().y;
-        break;
-    default:
-        wxASSERT(false);
-        break;
+ case ORIGIN_REFERENCE_AUX: origin = m_PcbBaseFrame->GetAuxOrigin().y; break; + case ORIGIN_REFERENCE_GRID: origin = m_PcbBaseFrame->GetGridOrigin().y; break;
+    default: wxASSERT( false ); break;
      }

      // Invert the direction if needed

This is a weird style that I don't personally like, and IMO goes against the style implied by our "spacious" bracing and newline-before-if policies. But there are quite some uses of it. It's enforced by this line:

    AllowShortCaseLabelsOnASingleLine: true

It's the only line-condensing option we have set:

    AllowShortBlocksOnASingleLine: false
    AllowShortCaseLabelsOnASingleLine: true # the only true here
    AllowShortFunctionsOnASingleLine: false
    AllowShortIfStatementsOnASingleLine: false
    AllowShortLoopsOnASingleLine: false

If the formatter is proposing a change that goes against the existing style in the code area in question, I do not think it's controversial to ignore its suggestion.

@Wayne, what do you think: is this enforcement representative of the right style? Should we change AllowShortCaseLabelsOnASingleLine to false? (+1 from me).

Cheers,

John


Follow ups

References