This shows you the differences between two versions of the page.
convention [2018/03/28 15:41] |
convention [2023/08/14 09:40] (current) rzr [MISC] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | [[Convention]]s / Recommendations for Better [[Integration]] | ||
+ | |||
+ | ===== software ===== | ||
+ | |||
+ | * http://en.wikipedia.org/wiki/Prettyprint | ||
+ | * http://editorconfig.org/ | ||
+ | |||
+ | * https://github.com/zeke/semantic-pull-requests# | ||
+ | * https://tools.ietf.org/html/rfc1855# EMaiL | ||
+ | |||
+ | @TaG: [[Programming]] | ||
+ | |||
+ | ===== commit ==== | ||
+ | |||
+ | * https://www.conventionalcommits.org/en/v1.0.0/# GiT CommiT LoG | ||
+ | * https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status | ||
+ | |||
+ | |||
+ | |||
+ | ===== References ===== | ||
+ | |||
+ | Try to follow the Existing coding standards : | ||
+ | |||
+ | * http://www.gnu.org/prep/standards_toc.html | ||
+ | * http://en.tldp.org/HOWTO/Software-Release-Practice-HOWTO/distpractice.html | ||
+ | * http://www.possibility.com/Cpp/CppCodingStandard.html | ||
+ | * http://home.gna.org/ngl/doc_coding.html | ||
+ | * http://ima.udg.es/~frederic/ResearchInterest/ToddHoffGL.html# [[CPlusPlus]] | ||
+ | * http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Names_and_Order_of_Includes | ||
+ | * http://lxr.linux.no/linux/Documentation/CodingStyle# [[Linux]] : | ||
+ | * http://www.faqs.org/docs/Linux-HOWTO/C-C++Beautifier-HOWTO.html | ||
+ | * http://news.nopcode.org/miau/wk/BadCoding | ||
+ | * https://secure.wikimedia.org/wikipedia/fr/wiki/TOFU_%28Usenet_et_Internet%29# [[email]] : Read top reply bottom | ||
+ | * https://wiki.tizen.org/wiki/Native_Platform_Coding_Idiom_and_Style_Guide# TizeN | ||
+ | |||
+ | |||
+ | ==== Project Structure ==== | ||
+ | |||
+ | Source Directory package (use lowercase and add '-' and version to filename) : | ||
+ | |||
+ | prefered : | ||
+ | |||
+ | * [[Debian]] , note that last - preceade version number ) | ||
+ | tar cfvz package-name_1.2.0.tar.gz package-name-1.2.0/ | ||
+ | |||
+ | * [[Windows]] keep dot for extensions | ||
+ | zip package_name-1_2_0.zip package_name-1.2.0/ | ||
+ | |||
+ | Avoid : | ||
+ | PackageName or package_name for dir and archives | ||
+ | |||
+ | |||
+ | makefile hints : | ||
+ | |||
+ | ${PACKAGE}-$(VERS).tar.gz: | ||
+ | @ls $(SRC) | sed s:^:${PACKAGE}-$(VERS)/: >MANIFEST | ||
+ | @(cd ..; ln -s ${PACKAGE} ${PACKAGE}-$(VERS)) | ||
+ | (cd ..; tar -czvf ${PACKAGE}/${PACKAGE}-$(VERS).tar.gz `cat ${PACKAGE}/MANIFEST`) | ||
+ | @(cd ..; rm ${PACKAGE}-$(VERS)) | ||
+ | |||
+ | |||
+ | |||
+ | Please provide those additional files : | ||
+ | |||
+ | * COPYING : a copy of the [[Licence]], check http://opensource.org | ||
+ | * AUTHORS : all authors and contibutors | ||
+ | * README : short description | ||
+ | * INSTALL : how to install | ||
+ | * NEWS : new features, since last package | ||
+ | |||
+ | |||
+ | ==== Sources ==== | ||
+ | |||
+ | * line length must not exceed 79 characters (75 preffered emails , 77cols*50row for a4) | ||
+ | * indentation should be carried out by <space> characters only | ||
+ | (no <TAB>, as this is interpreted very differently between editors) | ||
+ | * indentation: Emacs-C-mode-style (tab=2 chars) | ||
+ | this is also easy to achieve with "indent" without any parameters (GNU style), exceptions (not mandatory): | ||
+ | * on [[MSVC]] : Tools / Options / Edit / [[C++]] : indent=block tab=space , tab=2 ident=2 | ||
+ | |||
+ | |||
+ | Preferred : | ||
+ | |||
+ | * no trailing white space at the end of a line | ||
+ | * no DOS line endings (not CRLF but just LF) | ||
+ | |||
+ | [[Software]] : http://sourceforge.net/projects/astyle/ | ||
+ | |||
+ | ==== [[Java]] ==== | ||
+ | |||
+ | Follow sun conventions | ||
+ | |||
+ | * [[java]]: http://www.oracle.com/technetwork/java/codeconv-138413.html | ||
+ | |||
+ | |||
+ | ====[[C]]==== | ||
+ | |||
+ | * all preprocessor definitions/macros are starting CAPS | ||
+ | * filenames lowercase | ||
+ | |||
+ | Usefull decoration (note the 80 cols delimitor and RCS keywords ) | ||
+ | |||
+ | /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ | ||
+ | /* #ident "$Id: myfile.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $" | ||
+ | /* Author: ${LOGNAME} <${EMAIL}>, (C) YYYY - $Author:$ | ||
+ | /* Copyright: See README file that comes with this distribution | ||
+ | /****************************************************************************/ | ||
+ | #ifndef MyFile_h_ | ||
+ | #define MyFile_h_ | ||
+ | |||
+ | #endif | ||
+ | /* vi: set ts=4 sw=4 expandtab: */ | ||
+ | /* #eof "$Id: myfile.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $" */ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====[[CPlusPlus]]==== | ||
+ | |||
+ | see C | ||
+ | |||
+ | //* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- | ||
+ | //* vim: ft=cpp:expandtab:ts=2:sw=4:softtabstop=4: | ||
+ | //* #ident "$Id: file.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $" | ||
+ | //* SPDX-Licence-Identifier: GPL3+ | ||
+ | //* Author: ${LOGNAME} <${EMAIL}>, (C) YYYY - $Author:$ | ||
+ | //* Copyright: See README file that comes with this distribution | ||
+ | //****************************************************************************/ | ||
+ | #ifndef ClassName_h_ | ||
+ | #define ClassName_h_ | ||
+ | class ClassName | ||
+ | { | ||
+ | public: | ||
+ | void functionName(); | ||
+ | |||
+ | void functionContents() | ||
+ | { //<= jump to funct | ||
+ | if ( true ) { // comment | ||
+ | int a=42; | ||
+ | } //<= aligned with if statetement | ||
+ | } | ||
+ | |||
+ | protected: | ||
+ | char* p_name_; | ||
+ | }; | ||
+ | #endif | ||
+ | /* #eof "$Id: file.h,v 1.1 YYY/MM/DD HH:MM:SS ${USER} Exp $" */ | ||
+ | |||
+ | file.h # namespace "foo" { #include "foo.hpp" } | ||
+ | file.hxx # templates + .cxx for implem | ||
+ | |||
+ | * https://isocpp.org/wiki/faq/coding-standards# | ||
+ | * http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-raise# | ||
+ | ==== Other Languages ==== | ||
+ | |||
+ | Try to reuse previous conventions without overloading default ones | ||
+ | |||
+ | static char THIS_FILE[[]] = **FILE**; // [[WinCE]] | ||
+ | |||
+ | |||
+ | ViM : GnuMake : | ||
+ | |||
+ | # ex: set tabstop=4 noexpandtab: | ||
+ | |||
+ | Python : | ||
+ | |||
+ | # -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*- | ||
+ | |||
+ | |||
+ | ===== TODO ===== | ||
+ | |||
+ | * Gnumake: # ex: set tabstop=4 noexpandtab: | ||
+ | * EmacS | ||
+ | * https://keepachangelog.com/en/1.0.0/# | ||
+ | |||
+ | ===== MISC ===== | ||
+ | |||
+ | Filename : 16 char ( [[Peekton]] ) | ||
+ | |||
+ | * http://www.gnu.org/prep/standards/html_node/Change-Logs.html#Change-Logs | ||
+ | * http://www.debian.org/MailingLists/#codeofconduct http://people.debian.org/~enrico/dcg/ | ||
+ | * [[Portability]] : http://www.cs.wustl.edu/~schmidt/ACE.html | ||
+ | * http://live.gnome.org/Rygel/CodingStyle | ||
+ | * https://wiki.iotivity.org/iotivity_c_coding_standards | ||
+ | * http://chris.beams.io/posts/git-commit/# CommiT | ||
+ | * https://dhwthompson.com/2019/my-favourite-git-commit | ||
+ | |||
+ | LinuX: | ||
+ | |||
+ | * http://www.lanana.org/lsbreg/instructions.html | ||
+ | * http://www.lanana.org/lsbreg/providers/index.html | ||
+ | * https://www.gobolinux.org/ | ||
+ | |||
+ | LegaL: | ||
+ | |||
+ | * https://spdx.github.io/spdx-spec/appendix-IX-file-tags/# | ||
+ | * https://tools.ietf.org/html/rfc1855# | ||
+ | |||
+ | MisC : | ||
+ | |||
+ | * https://www.m31coding.com/blog/semantic-reviews.html# | ||
+ | |||
+ | |||
+ | ===== MORE ===== | ||
+ | |||
+ | @TaG: [[Programming]] MetH Commit GiT | ||
+ | |||
+ | {{http://imgs.xkcd.com/comics/standards.png}} | ||