diff options
| -rw-r--r-- | CODING | 35 | ||||
| -rw-r--r-- | doc/developer-guidelines.sgml | 53 |
2 files changed, 17 insertions, 71 deletions
| @@ -7,33 +7,20 @@ readability in a wide range of environments. | |||
| 7 | 7 | ||
| 8 | 1. C Language Programming | 8 | 1. C Language Programming |
| 9 | 9 | ||
| 10 | All code should comply with the requirements of the Free Software | 10 | All code should comply with most of the requirements of the Free Software |
| 11 | Foundation Coding standards (which are currently available at | 11 | Foundation Coding standards (which are currently available at |
| 12 | http://www.gnu.org/prep/standards_toc.html). We also follow most of | 12 | https://www.gnu.org/prep/standards/standards.html ). |
| 13 | the FSF guidelines. Developers may suggest deviations from the FSF | 13 | We also follow most of the FSF guidelines, with the huge and explicit |
| 14 | exception of the style guidelines. | ||
| 15 | Developers may suggest deviations from the FSF | ||
| 14 | style recommendations, which will be considered by open discussion on | 16 | style recommendations, which will be considered by open discussion on |
| 15 | the Monitoring Plugins devel mailing list. Any such deviations will | 17 | the Monitoring Plugins devel mailing list or the Github Pull Request. |
| 16 | apply to the entire code base to ensure consistency. | 18 | Any such deviations should be |
| 17 | 19 | applied to the entire code base to ensure consistency. | |
| 18 | Currently, the exceptions to FSF recommendations are roughly equivalent | ||
| 19 | to GNU indent with invoked as 'indent -ts 2 -br'. Specifically, the | ||
| 20 | exceptions are as follows: | ||
| 21 | |||
| 22 | a) leading white space for a statement should be formatted as tabs, | ||
| 23 | with one tab for each code indentation level. | ||
| 24 | |||
| 25 | b) in statement continuation lines, format whitespace up to the column | ||
| 26 | starting the statement as tabs, format the rest as spaces (this | ||
| 27 | results in code that is legible regardless of tab-width setting). | ||
| 28 | |||
| 29 | c) with the exception of the above, tabs should generally be avoided | ||
| 30 | |||
| 31 | d) when tab width is 2 spaces, line-length should not exceed 80 | ||
| 32 | characters | ||
| 33 | |||
| 34 | e) The opening brace of an if or while block is on the same line as | ||
| 35 | the end of the conditional expression (the '-br' option). | ||
| 36 | 20 | ||
| 21 | The style guideline is the following: | ||
| 22 | Whatever clang-format does with the configuration file available (.clang-format) | ||
| 23 | Apart from that, code should naturally be readable and easy to understand. | ||
| 37 | 24 | ||
| 38 | 2. Perl Language Programming | 25 | 2. Perl Language Programming |
| 39 | 26 | ||
diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml index 37c963ed..0afa733b 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> |
