FEM: update imports in coding conventions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# FEM coding_conventions
|
||||
These coding rules apply to FEM module code only. Other modules or the base system may use different coding rules especially in naming policy of Python.
|
||||
|
||||
|
||||
## Spelling
|
||||
- Be mindful of spelling. Spell checks are quite often neglected.
|
||||
- Utilize [codespell](https://github.com/codespell-project/codespell) to discover and quickly correct spelling errors.
|
||||
@@ -17,6 +18,7 @@ These coding rules apply to FEM module code only. Other modules or the base syst
|
||||
2) To find the most amount of typos we recommend running a quick `pip install --upgrade`
|
||||
See the [codespell docs](https://github.com/codespell-project/codespell#updating) for more info.
|
||||
|
||||
|
||||
## Python and C++
|
||||
### Code formatting
|
||||
- All files should have a license header
|
||||
@@ -43,9 +45,10 @@ These coding rules apply to FEM module code only. Other modules or the base syst
|
||||
|
||||
### Imports
|
||||
- Only one import per line.
|
||||
- Even on import from some_module import something. There should only be one something per line.
|
||||
- on import from 'some_package' import 'some_module'. There should only be one 'some_module' per line.
|
||||
- on import from 'some_module' import 'some_method'. There should only be one 'some_method' per line.
|
||||
- Each import group should be sorted alphabetically.
|
||||
- First the import some_module ones, afterwards the from some_module import something.
|
||||
- First the 'import some_module' ones, afterwards the 'from some_module import something'.
|
||||
- First absolute path imports than relative path imports.
|
||||
- On relative path imports first the one dot ones, afterwards the two dot ones.
|
||||
- Star import should not be used at all (from some_module import *).
|
||||
@@ -54,18 +57,25 @@ These coding rules apply to FEM module code only. Other modules or the base syst
|
||||
- One empty line
|
||||
- Third-party imports
|
||||
- One empty line
|
||||
- FreeCAD-specific imports from module FreeCAD
|
||||
- One empty line
|
||||
- Other FreeCAD non Gui imports
|
||||
- One empty line
|
||||
- non Gui FreeCAD specific imports
|
||||
- from module FreeCAD
|
||||
- One empty line
|
||||
- other modules, but not FEM
|
||||
- One empty line
|
||||
- FEM specific imports
|
||||
- absolute imports
|
||||
- One empty line
|
||||
- relative imports
|
||||
- One empty line
|
||||
- FreeCAD Gui imports:
|
||||
- The import of Gui modules should be guarded by a 'if FreeCAD.GuiUp:'
|
||||
- On Gui only modules the guard is not needed
|
||||
- Same as above but without an empty line
|
||||
- Same as above but without a empty line
|
||||
- Standard library imports
|
||||
- Third-party Gui imports
|
||||
- FreeCAD-specific imports from module FreeCADGui
|
||||
- other FreeCAD Gui imports
|
||||
- FEM Gui imports
|
||||
- The above paragraphs highly reduces merge conflicts.
|
||||
|
||||
### Naming policy
|
||||
@@ -117,6 +127,7 @@ Python style is preferred over Doxygen style
|
||||
- if this is not available the object can not even created
|
||||
- if task panel is separate the object can be createdh
|
||||
|
||||
|
||||
## C++
|
||||
### Naming policy
|
||||
- CamelCase names
|
||||
@@ -126,6 +137,7 @@ Python style is preferred over Doxygen style
|
||||
- Do not use to many slashes in a row. This could cause trouble with Doxygen.
|
||||
- see [PR with comment](https://github.com/FreeCAD/FreeCAD/pull/2757#discussion_r355218913)
|
||||
|
||||
|
||||
## Icons
|
||||
### Naming plicy
|
||||
- Command icons use the command name.
|
||||
|
||||
Reference in New Issue
Block a user