Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| de:modul:ffit:3-jahr:cicd:learningunits:lu01:b [2026/01/20 11:12] – apeter | de:modul:ffit:3-jahr:cicd:learningunits:lu01:b [2026/01/20 15:28] (aktuell) – apeter | ||
|---|---|---|---|
| Zeile 3: | Zeile 3: | ||
| ==== Formatting ==== | ==== Formatting ==== | ||
| - | '' | + | Formatter sorgen dafür, dass der gemeinsame Code einheitlich formatiert wird. Oftmals besitzen IDE bereits eine Standard-Formattierung oder die Möglichkeit, |
| + | |||
| + | Beispiele von IDE-spezifischen Formatierungen: | ||
| + | * **IntelliJ**: | ||
| + | * **Visual Studio Code**: Settings unter '' | ||
| + | * **Eclipse: Code Style Formatter**: | ||
| + | * **Diverse IDE**: '' | ||
| + | |||
| + | ^ IntelliJ Project.xml ^ VS Code settings.json ^ Eclipse java-formatter.xml ^ .editorconfig ^ | ||
| + | | < | ||
| + | </ | ||
| + | < | ||
| + | <!-- Tab size --> | ||
| + | < | ||
| + | <option name=" | ||
| + | <option name=" | ||
| + | <option name=" | ||
| + | </ | ||
| + | |||
| + | <!-- New line at end of file --> | ||
| + | <option name=" | ||
| + | </ | ||
| + | ...</ | ||
| + | // Tab size | ||
| + | " | ||
| + | " | ||
| + | |||
| + | // New line at end of file | ||
| + | " | ||
| + | |||
| + | // Java-specific | ||
| + | " | ||
| + | |||
| + | // Remove unused imports | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | }</ | ||
| + | <profile kind=" | ||
| + | |||
| + | <!-- Tab size --> | ||
| + | <setting id=" | ||
| + | <setting id=" | ||
| + | <setting id=" | ||
| + | |||
| + | <!-- New line at end of file --> | ||
| + | <setting id=" | ||
| + | |||
| + | </ | ||
| + | ...</ | ||
| + | [*] | ||
| + | indent_style = space | ||
| + | indent_size = 4 | ||
| + | tab_width = 4 | ||
| + | |||
| + | end_of_line = lf | ||
| + | insert_final_newline = true | ||
| + | trim_trailing_whitespace = true | ||
| + | ...</ | ||
| + | |||
| + | Das Problem von solchen Konfigurationen ist ihre Abhängigkeit zu der IDE. Sobald ein Teammitglied eine andere IDE nutzt, kommt es früher oder später zu Formatierungsunterschieden, | ||
| + | Ein weiteres Nachteil ist, dass solche Formatierungen in der Regel nicht in die Build-Pipeline eingebaut werden können. | ||
| + | |||
| + | Daher würde ich IDE-unabhängige Formatter bei komplexeren Formatierungsregeln bevorzugen. Einfache Regeln (Einrückungen, | ||
| + | |||
| + | Beispiele von IDE-unabhängigen Formatter-Bibliotheken: | ||
| + | * Javascript, Typescript, HTML, CSS, JSON -> Prettier | ||
| + | * Python -> black, pep8, ... | ||
| + | * Java -> Google Java Format | ||
| ==== Linting ==== | ==== Linting ==== | ||
| Zeile 11: | Zeile 79: | ||
| * Javascript, Typescript -> ESLint(https:// | * Javascript, Typescript -> ESLint(https:// | ||
| * Python -> Pylint (https:// | * Python -> Pylint (https:// | ||
| - | * Java -> PMD | + | * Java -> PMD (https:// |
| - | * Diverse Sprachen -> SonarLint | + | * Diverse Sprachen -> SonarQube for IDE (SonarLint) |
| - | + | ||
| - | + | ||