All Projects → intersystems-ru → cos-guidelines

intersystems-ru / cos-guidelines

Licence: MIT license
Caché ObjectScript contibutors guidelines

Projects that are alternatives of or similar to cos-guidelines

BlocksExplorer
Database Blocks Explorer for InterSystems Caché
Stars: ✭ 12 (-20%)
Mutual labels:  intersystems, intersystems-cache
webterminal
The first and the most powerful web-based terminal for InterSystems IRIS®, InterSystems Caché®, Ensemble®, HealthShare®, TrakCare® and other products built on top of InterSystems Data Platforms.
Stars: ✭ 71 (+373.33%)
Mutual labels:  intersystems, intersystems-cache
vscode-objectscript
InterSystems ObjectScript extension for Visual Studio Code
Stars: ✭ 94 (+526.67%)
Mutual labels:  intersystems, intersystems-cache
vscode-cos
Add Caché ObjectScript support for vscode
Stars: ✭ 14 (-6.67%)
Mutual labels:  intersystems, intersystems-cache
Php Cs Fixer
A tool to automatically fix PHP Coding Standards issues
Stars: ✭ 10,709 (+71293.33%)
Mutual labels:  code-style
Editorconfig Netbeans
A NetBeans IDE plugin supporting the EditorConfig standard. ⛺
Stars: ✭ 123 (+720%)
Mutual labels:  code-style
Hippo
PHP standards checker.
Stars: ✭ 82 (+446.67%)
Mutual labels:  code-style
Php Cs Fixer Custom Fixers
A set of custom fixers for PHP CS Fixer
Stars: ✭ 75 (+400%)
Mutual labels:  code-style
guidelines
📒 Guidelines on random topics I have learnt so far
Stars: ✭ 27 (+80%)
Mutual labels:  guidelines
guides
Dealerdirect guides for getting things done, be a programming role-model, coding in style and being the better colleague.
Stars: ✭ 21 (+40%)
Mutual labels:  guidelines
Twig-CS-Fixer
A tool to automatically fix Twig Coding Standards issues
Stars: ✭ 61 (+306.67%)
Mutual labels:  code-style
Fig Rectified Standards
The FIG PSR-2 that actually makes sense (not political but reasonable decisions).
Stars: ✭ 132 (+780%)
Mutual labels:  code-style
gulp-upload-qcloud
腾讯云 cos 静态资源上传 gulp 插件
Stars: ✭ 18 (+20%)
Mutual labels:  cos
bc
some useful math functions for linux calculator bc
Stars: ✭ 18 (+20%)
Mutual labels:  cos
Ios Style
Guidelines for iOS development in use at Spotify
Stars: ✭ 233 (+1453.33%)
Mutual labels:  code-style
Elm Format
elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
Stars: ✭ 1,240 (+8166.67%)
Mutual labels:  code-style
f2e-spec
Alibaba Front-end Coding Guidelines and Relevant Tools
Stars: ✭ 548 (+3553.33%)
Mutual labels:  guidelines
Uncrustify
Code beautifier
Stars: ✭ 2,442 (+16180%)
Mutual labels:  code-style
Lint Action
✨ GitHub Action for detecting and auto-fixing lint errors
Stars: ✭ 161 (+973.33%)
Mutual labels:  code-style
handbook
📙 ErgoServ Developer's Handbook - a collection of guides, recipes, and scripts for helping you get things done, better.
Stars: ✭ 46 (+206.67%)
Mutual labels:  guidelines

Caché ObjectScript Code Guidelines

This is the first approximation of Caché ObjectScript guidelines we use for github.com/intersystems-ru projects. There are mandatory and recommended parts.

We do not plan to be very restrictive, but want be rather flexible enough and allow any reasonable style. Here is the general advice: use common sense and try to be consistent wherever you write code. If there is some style already established in the class or utility being modified then we recommend to continue use that same style, than introducing yet another one, which may be more recommended but which will be introducing some unnecessary inconsistency.

Quick Reference Guide

For Caché ObjectScript quick reference guide see here.

Mandatory Part

  • Only "modern" syntax permitted, dotted syntax is not generally allowed (with few exceptions);
  • No short name for statements keywords or built-in functions allowed - use fully expanded names;
  • Comment your code appropriately, use English in comments to make your code easy to understand by your international colleagues. Same English-based rule applies to global, local, and type names.

Recommended Part

  • We recommend to use fully expanded keyword or function name in lower case or capitalized. Whatever you'll select should be consistent across class or utility, i.e.
If (expression) {
  Do ##class(Sample).%New(initexpresion)
  For i=1:1:10 {
    Write something, $ZVersion, !
  }
}

or

 if (expression) {
   do ##class(Sample).%New(initexpresion)
   for i=1:1:10 {
     write something, $zversion, !
   }
 }
  • We recommend to use fully qualified package name of a class (except %Library package)
Set obj = ##class(Sample.Person).%New(initexpresion)

instead of

Set obj = ##class(Person).%New(initexpresion)
  • In general, use the reasonable name convention consistently across whole hierarchy. We recommend to use CamelCase for classes, methods and properties (e.g. Sample.Person, OpenFile, LastIndex, etc.), but smallCamelCase for local variables (e.g. startDate, endDate), but please be consistent and use local schema if it's different than current recommendation.
  • We recommend to use #dim statement for declaration of local variables types, e.g.
  #dim array as %ArrayOfDataTypes = ##class(%ArrayOfDataTypes).%New()
  do array.SetAt(id, "id")
  #dim status As %Status = $$$OK

This will help editor to provide better auto-complete, and eventually will be used by static checker for type information extraction.

  • Please indent blocks reasonably. We recommend to use 8, 4 or 2 spaces indentations. Pick your level, and apply consistently.
    if (expression) {
        do ..Method(args...)
        set i = j + 1
    } else {
        while (condition) {
            write arg1, arg2, !
        }
    }
  • For better readability please insert spaces after comma in functions/methods argument list, i.e.
  Write 1, 2, 3
  Do ..Method(arg1, arg2, argN)

For obvious reasons this recommendation not applies to arguments in $$$macro-call, where such extra spaces will break final result.

  • For better readability please insert spaces around assignment. You may align several neighbour assignments according to your tastes, i.e.
  #dim index As %Integer = 0
  #dim countOfItems As %Integer = ..Count()
  set j  = k + 1
  set iN = jN \ l

Related discussion

Standards document for Objectscript developers

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].