Metamation Developer Notes

  • Developer Notes
  • Resource Map
  • Tools
    • Code Formatting
    • Configuring Git
    • Assignments
    • Testing with Windows Sandbox
    • Single Binary Applications
    • Self-Updating Applications
  • Flux Workflow
    • Flux Workflow
    • Flux Development Style Guide
    • Release notes for Flux
    • SonarCloud analysis for Flux
    • Build a Flux SDK Program
    • Shipping Flux
    • Flux.Test
      • BasicBendAuto Test
      • LaserAuto.cs Detailed Documentation
      • Laserexample:Test1
  • Technical Notes
    • File formats
      • .FX File Format
      • Au(Gold) streams
      • .GEO File Format
      • .LST File Format
      • .LST file - technology
      • .BNC File Format
      • .WAD Files: Flux Resource Packages
      • .Curl Files: ASCII config information
    • Folders App
      • Data\Bendtools
      • Data\Machines
    • FluxCode
      • Welcome & Repo Map
      • Architecture & System Context
      • Subsystem *Bend* (Press Brake)
      • Subsystem *BCell* (Bend Cell Automation)
      • API Maps
      • Data Model Catalog
      • Design Patterns -- A Reader's Guide
      • Tests and Golden Paths
      • Guided Code Tours
      • CAM Glossary with Code Mapping
      • Assignments
      • Flux Onboarding Handbook
    • Data flow
      • Part
        • Part.Dwg
        • Part.Load
        • Part.Load to Part.Dwg
      • BendTech.cs
      • Bend Technology
      • Laser Cutting Technology
    • LTS (Long term support mechanism)
    • Machine ID Scheme
  • FluxTester
    • Commands and Scripts
    • Command Cookbook
    • Script Commands
    • BendTooling.cs Test Inventory
    • LaserTooling.cs Test Steps
    • Fluxtester Recipe Book
    • Nesting.cs Overview
    • Nesting.cs Recipe Book
    • Job.cs Overview
    • Job.cs Recipe Book
  • Software license
  • 3d party software
    • Python
  • Documentation
    • Bento documentation
      • Structure of a Bento page
      • Attributes
    • Software
      • Software Requirement
      • Installation
      • Git workflow for documentation contributors
    • Quick start guide
    • Workflow
      • Roles and responsibilities
      • Analyze
      • Edit
      • Proofread
      • Pre-Publish
      • Publish
      • Release cycle
      • Information required for Documentation Team
      • Checklist for Documenters
    • Styleguide
    • Flavoring
    • Translation
      • Ordering translation for a new document
    • Citations
    • Annotation
Tools
/
Code Formatting

Code Formatting

Format settings for Visual Studio

This document explains the Metamation conventions for formatting C# code.

Tabs

Use Spaces instead of Tab characters in source files. Set the indent level as 3 spaces. (2 is too narrow, 4 is too wide, 3 is the Goldilocks number).

Indentation, Newlines and Spacing

Metamation indentation style is a mix between the K&R Style and the 1TBS (One True Brace Style). Like K&R style, we generally dispense with the braces when there is only one statement in the block. Like 1TBS, we place the braces opening a function on the same line as the function header.

That is:

void CheckLevel () {
   if (nLevel > 0 && !mLevelStack.IsEmpty)
      PopLevel ();
}

However, this is discretionary. If you think adding braces clarifies the meaning, add them.

Here are how we configure Visual Studio to get the exact indentation, newlines and spacing settings that we want. Once configured, the editor will reformat your code using these settings each time you complete a block, ensuring consistency. Go to the Tools / Options dialog, and you can find these settings under Text Editor / C# / Code Style / Formatting

Indentation Settings

A key point with these brace styles it that we try to reduce the number of lines code occupies. Thus, the New Lines section of the Visual Studio editor is configured by turning all the new line check-boxes off:

NewLines Settings

Continuing the brevity theme, the Wrapping settings are configured thus:

Wrapping Settings

The spacing rules are set like this:

Spacing Settings

Contents

  • Format settings for Visual Studio
  • Tabs
  • Indentation, Newlines and Spacing
Tools Configuring Git

      Copyright © 2025 TRUMPF Metamation. All rights reserved.

    Compiled by Bento