summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CODING35
-rw-r--r--doc/developer-guidelines.sgml53
2 files changed, 17 insertions, 71 deletions
diff --git a/CODING b/CODING
index 74438e7..d0673e7 100644
--- a/CODING
+++ b/CODING
@@ -7,33 +7,20 @@ readability in a wide range of environments.
7 7
81. C Language Programming 81. C Language Programming
9 9
10All code should comply with the requirements of the Free Software 10All code should comply with most of the requirements of the Free Software
11Foundation Coding standards (which are currently available at 11Foundation Coding standards (which are currently available at
12http://www.gnu.org/prep/standards_toc.html). We also follow most of 12https://www.gnu.org/prep/standards/standards.html ).
13the FSF guidelines. Developers may suggest deviations from the FSF 13We also follow most of the FSF guidelines, with the huge and explicit
14exception of the style guidelines.
15Developers may suggest deviations from the FSF
14style recommendations, which will be considered by open discussion on 16style recommendations, which will be considered by open discussion on
15the Monitoring Plugins devel mailing list. Any such deviations will 17the Monitoring Plugins devel mailing list or the Github Pull Request.
16apply to the entire code base to ensure consistency. 18Any such deviations should be
17 19applied to the entire code base to ensure consistency.
18Currently, the exceptions to FSF recommendations are roughly equivalent
19to GNU indent with invoked as 'indent -ts 2 -br'. Specifically, the
20exceptions are as follows:
21
22a) leading white space for a statement should be formatted as tabs,
23with one tab for each code indentation level.
24
25b) in statement continuation lines, format whitespace up to the column
26starting the statement as tabs, format the rest as spaces (this
27results in code that is legible regardless of tab-width setting).
28
29c) with the exception of the above, tabs should generally be avoided
30
31d) when tab width is 2 spaces, line-length should not exceed 80
32characters
33
34e) The opening brace of an if or while block is on the same line as
35the end of the conditional expression (the '-br' option).
36 20
21The style guideline is the following:
22Whatever clang-format does with the configuration file available (.clang-format)
23Apart from that, code should naturally be readable and easy to understand.
37 24
382. Perl Language Programming 252. Perl Language Programming
39 26
diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml
index 37c963e..0afa733 100644
--- a/doc/developer-guidelines.sgml
+++ b/doc/developer-guidelines.sgml
@@ -14,15 +14,8 @@
14 <pubdate>2013</pubdate> 14 <pubdate>2013</pubdate>
15 <title>Monitoring Plugins Development Guidelines</title> 15 <title>Monitoring Plugins Development Guidelines</title>
16 16
17 <revhistory>
18 <revision>
19 <revnumber>1796</revnumber>
20 <date>2007-09-24 14:51:07 -0400 (Mon, 24 Sep 2007)</date>
21 </revision>
22 </revhistory>
23
24 <copyright> 17 <copyright>
25 <year>2000 - 2013</year> 18 <year>2000 - 2024</year>
26 <holder>Monitoring Plugins Development Team</holder> 19 <holder>Monitoring Plugins Development Team</holder>
27 </copyright> 20 </copyright>
28 21
@@ -34,7 +27,7 @@
34 the plugin developers and encourage the standardization of the 27 the plugin developers and encourage the standardization of the
35 different kind of plugins: C, shell, perl, python, etc.</para> 28 different kind of plugins: C, shell, perl, python, etc.</para>
36 29
37 <para>Monitoring Plugins Development Guidelines Copyright (C) 2000-2013 30 <para>Monitoring Plugins Development Guidelines Copyright (C) 2000-2024
38 (Monitoring Plugins Team)</para> 31 (Monitoring Plugins Team)</para>
39 32
40 <para>Permission is granted to make and distribute verbatim 33 <para>Permission is granted to make and distribute verbatim
@@ -383,13 +376,6 @@
383 <para>It is up to third party programs to convert the Monitoring Plugins 376 <para>It is up to third party programs to convert the Monitoring Plugins
384 performance data into graphs.</para> 377 performance data into graphs.</para>
385 </section> 378 </section>
386
387 <section><title>Translations</title>
388 <para>If possible, use translation tools for all output to respect the user's language
389 settings. See <xref linkend="translationsdevelopers"> for guidelines
390 for the core plugins.
391 </para>
392 </section>
393</section> 379</section>
394 380
395<section id="SysCmdAuxFiles"><title>System Commands and Auxiliary Files</title> 381<section id="SysCmdAuxFiles"><title>System Commands and Auxiliary Files</title>
@@ -727,19 +713,18 @@ setup the tests. Run "make test" to run all the tests.
727</section> 713</section>
728<section id="CodingGuidelines"><title>Coding guidelines</title> 714<section id="CodingGuidelines"><title>Coding guidelines</title>
729 <para>See <ulink url="http://www.gnu.org/prep/standards_toc.html">GNU 715 <para>See <ulink url="http://www.gnu.org/prep/standards_toc.html">GNU
730 Coding standards</ulink> for general guidelines.</para> 716 Coding standards</ulink> for general guidelines.
717 Some parts of the guidelines (namely and explicitly the coding style)
718 are not seen as best practice by us.</para>
731 <section><title>C coding</title> 719 <section><title>C coding</title>
732 720
733 <para>Variables should be declared at the beginning of code blocks and
734 not inline because of portability with older compilers.</para>
735
736 <para>You should use the type "bool" and its values 721 <para>You should use the type "bool" and its values
737 "true" and "false" instead of the "int" type for booleans. 722 "true" and "false" instead of the "int" type for booleans.
738 </para> 723 </para>
739 </section> 724 </section>
740 725
741 <section><title>Crediting sources</title> 726 <section><title>Crediting sources</title>
742 <para>If you have copied a routine from another source, make sure the licence 727 <para>If you have copied a routine from another source, make sure the license
743 from your source allows this. Add a comment referencing the ACKNOWLEDGEMENTS 728 from your source allows this. Add a comment referencing the ACKNOWLEDGEMENTS
744 file, where you can put more detail about the source.</para> 729 file, where you can put more detail about the source.</para>
745 <para>For contributed code, do not add any named credits in the source code 730 <para>For contributed code, do not add any named credits in the source code
@@ -756,32 +741,6 @@ setup the tests. Run "make test" to run all the tests.
756 <para>All commits will be written to a ChangeLog at release time. 741 <para>All commits will be written to a ChangeLog at release time.
757 </para> 742 </para>
758 </section> 743 </section>
759
760 <section id="translationsdevelopers"><title>Translations for developers</title>
761 <para>To make the job easier for translators, please follow these guidelines:</para>
762 <orderedlist>
763 <listitem><para>
764 Before creating new strings, check the po/monitoring-plugins.pot file to
765 see if a similar string
766 already exists
767 </para></listitem>
768 <listitem><para>
769 For help texts, break into individual options so that these can be reused
770 between plugins
771 </para></listitem>
772 <listitem><para>Try to avoid linefeeds unless you are working on a block of text</para></listitem>
773 <listitem><para>Short help is not translated</para></listitem>
774 <listitem><para>Long help has options in English language, but text translated</para></listitem>
775 <listitem><para>"Copyright" kept in English</para></listitem>
776 <listitem><para>Copyright holder names kept in original text</para></listitem>
777 <listitem><para>Debugging output does not need to be translated</para></listitem>
778 </orderedlist>
779 </section>
780
781 <section><title>Translations for translators</title>
782 <para>To create an up to date list of translatable strings, run: tools/gen_locale.sh</para>
783 </section>
784
785</section> 744</section>
786 745
787<section id="SubmittingChanges"><title>Submission of new plugins and patches</title> 746<section id="SubmittingChanges"><title>Submission of new plugins and patches</title>