From 5dc60126e49025c4f087181b9800250734f16066 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 25 Jun 2021 13:51:15 +0530 Subject: [PATCH] doc: add documentaion about wrapping long lines to coding guide Signed-off-by: Humble Chirammal --- docs/coding.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/coding.md b/docs/coding.md index 5a4c4ba6b..fc96b628d 100644 --- a/docs/coding.md +++ b/docs/coding.md @@ -69,6 +69,33 @@ import ( * Use log level `ERROR` when something occurs which is fatal to the operation, but not to the service or application. +### Wrap long lines + +At present, we restrict the number of chars in a line to `120` which is the +default value for the `lll` linter check we have in CI. If your source code line +or comment goes beyond this limit please try to organize it in such a way it +is within the line length limit and help on code reading. + +Example: + +``` +_, err := framework.RunKubectl(cephCSINamespace, "delete", "cm", "ceph-csi-encryption-kms-config", "--namespace", cephCSINamespace, "--ignore-not-found=true") +``` + +Instead of above long function signature, we can organize it to something like below +which is clear and help on easy code reading. + +``` +_, err := framework.RunKubectl( + cephCSINamespace, + "delete", + "cm", + "ceph-csi-encryption-kms-config", + "--namespace", + cephCSINamespace, + "--ignore-not-found=true") +``` + ### Mark Down Rules * MD014 - Dollar signs used before commands without showing output