... | @@ -66,37 +66,41 @@ Things that are being checked by the linter: |
... | @@ -66,37 +66,41 @@ Things that are being checked by the linter: |
|
|
|
|
|
The software is a really simple collection of scripts, and it can produce false-positives.
|
|
The software is a really simple collection of scripts, and it can produce false-positives.
|
|
|
|
|
|
**CLang**
|
|
**CLang-format**
|
|
|
|
|
|
Se avete un plugin per il vostro ide tanto meglio, altrimenti potete lanciarlo
|
|
Clang-format is a tool that helps mantaining the code clean and consistent with the chosen codestyle.
|
|
da command line con
|
|
|
|
`cat source.cpp | clang-format > source_figo.cpp`
|
|
There are many plugins out there for most of the IDEs (Vim, Visual Studio, Eclipse...).
|
|
oppure
|
|
Otherwise you can run it from terminal:
|
|
|
|
`cat source.cpp | clang-format > nice_style_source.cpp`
|
|
|
|
or
|
|
`clang-format -i source.cpp`
|
|
`clang-format -i source.cpp`
|
|
oppure
|
|
or
|
|
`find src/ -iname "*.cpp" -exec clang-format -i "{}" \;`
|
|
`find src/ -iname "*.cpp" -exec clang-format -i "{}" \;`
|
|
(ocio a tenere 'src/' se no reindenta tutto miosix XD)
|
|
(Remember the `src/`, otherwise the whole Miosix codebase will be formatted).
|
|
|
|
|
|
|
|
|
|
clang-format cerca un file chiamato '.clang-format' nella cartella attuale
|
|
Clang-format will search for a file called `.clang-format` in the working folder
|
|
o va a guardare tutte tutte le cartelle sopra. Se non lo trova, usa una config
|
|
or parent folders. If it doesn't find it, a default format will be used (you can tell
|
|
di default che non mi piace (lo vedert subito perche usa 2 spazi e parentesi
|
|
it's using the default style if you see spaces between `()` ).
|
|
in linea).
|
|
|
|
|
|
|
|
Ho visto che ogni tanto (non capisco il criterio) decide di indentare male
|
|
Sometimes it uses a strange indentation for enums. In general, if you don't want
|
|
le enum belle allineate. Potete evitare che tocchi qualche zona di codice
|
|
a particular part of the code to be touched by clang-format, put it inside a:
|
|
mettendola fra
|
|
|
|
```
|
|
```
|
|
// clang-format off
|
|
// clang-format off
|
|
...codice da non toccare
|
|
...codice da non toccare
|
|
// clang-format on
|
|
// clang-format on
|
|
```
|
|
```
|
|
|
|
|
|
Also, below you will find a description of how source files should be structured.
|
|
Files Stucture
|
|
|
|
-------------------
|
|
## Entrypoints Structure
|
|
|
|
|
|
|
|
*TODO FILE NAMING CONVENTIONS*
|
|
*TODO FILE NAMING CONVENTIONS*
|
|
|
|
|
|
|
|
Also, below you will find a description of how source files should be structured.
|
|
|
|
|
|
|
|
### Entrypoints Structure
|
|
|
|
|
|
*TODO COMMENT WITH \arg \returns ?*
|
|
*TODO COMMENT WITH \arg \returns ?*
|
|
|
|
|
|
#### 1) Copyrigth
|
|
#### 1) Copyrigth
|
... | @@ -204,7 +208,7 @@ void useLongNames(int explicitArg) |
... | @@ -204,7 +208,7 @@ void useLongNames(int explicitArg) |
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
## Header Files Structure
|
|
### Header Files Structure
|
|
```cpp
|
|
```cpp
|
|
/*LICENSE*/
|
|
/*LICENSE*/
|
|
#ifndef YOURHEADER_H
|
|
#ifndef YOURHEADER_H
|
... | | ... | |