Fix typos and misc. formatting [skip ci]

Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml`
This commit is contained in:
luz.paz
2019-10-20 15:47:38 -04:00
committed by Yorik van Havre
parent d87e6324e5
commit 1c981e8f14
33 changed files with 75 additions and 75 deletions

View File

@@ -45,7 +45,7 @@ namespace Fem {
* compatibility handling via handleChangedPropertyName.
*
* This implies that it is not checked which objects are put into the
* Analsis object. Every document object of FreeCAD can be part of a
* Analysis object. Every document object of FreeCAD can be part of a
* Analysis.
*/
class AppFemExport FemAnalysis : public App::DocumentObjectGroup {

View File

@@ -70,7 +70,7 @@ ConstraintFluidBoundary::ConstraintFluidBoundary()
"Basic boundary type like inlet, wall, outlet,etc");
BoundaryType.setEnums(BoundaryTypes);
ADD_PROPERTY_TYPE(Subtype,(1),"FluidBoundary",(App::PropertyType)(App::Prop_None),
"Subtype defines more specific boudnary types");
"Subtype defines more specific boundary types");
Subtype.setEnums(WallSubtypes);
ADD_PROPERTY_TYPE(BoundaryValue,(0.0),"FluidBoundary",(App::PropertyType)(App::Prop_None),
"Scaler value for the specific value subtype, like pressure, velocity magnitude");

View File

@@ -41,7 +41,7 @@ FemResultObject::FemResultObject()
ADD_PROPERTY_TYPE(Mesh,(0), "General",Prop_None,"Link to the corresponding mesh");
ADD_PROPERTY_TYPE(NodeNumbers,(0), "NodeData",Prop_None,"Numbers of the result nodes");
ADD_PROPERTY_TYPE(Stats,(0), "Data",Prop_None,"Statistics of the results");
ADD_PROPERTY_TYPE(Time,(0), "Data",Prop_None,"Time of analysis incement");
ADD_PROPERTY_TYPE(Time,(0), "Data",Prop_None,"Time of analysis increment");
// make read-only for property editor
NodeNumbers.setStatus(App::Property::ReadOnly, true);

View File

@@ -1,17 +1,24 @@
# 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.
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.
- [codespell]((https://github.com/codespell-project/codespell#updating) could be used
- Utilize [codespell](https://github.com/codespell-project/codespell) to discover and quickly correct spelling errors.
~~~
codespell -q 2 -S *.ts -L childs,dof,dum,methode,nd,normaly,uint,vertexes,freez src/Mod/Fem/
~~~
```bash
# Find typos
codespell -q 2 -S *.ts -L childs,dof,dum,methode,nd,normaly,uint,vertexes,freez src/Mod/Fem/
# Interactively fix said typos
codespell -i 3 -w -S *.ts -L childs,dof,dum,methode,nd,normaly,uint,vertexes,freez src/Mod/Fem/
```
**Notes:**
1) We recommend running the dev version as it uses the most up to date typo dictionaries.
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
### Code formatting
- All files should have a license header
- Unix line endings are preferred
- never use mixed line endings on one file
@@ -20,7 +27,7 @@ codespell -q 2 -S *.ts -L childs,dof,dum,methode,nd,normaly,uint,vertexes,freez
## Python
#### Code formatting
### Code formatting
- except W503 all Python code is pep8 compliant
- maximal line length is 100
- double quotes as string identifier
@@ -31,32 +38,29 @@ codespell -q 2 -S *.ts -L childs,dof,dum,methode,nd,normaly,uint,vertexes,freez
- snake_case_names
- ClassNames, variable_names_without_capitals and CONSTANTS_USE_CAPITALS, functions_without_capitals
- Function expected to return a value should indicate what is expected, so is_mesh_valid is a good name, but check_mesh is not a good name
- Class names, methode names and variable that are locally and not supposed to be used for scripting should start with underscore like _MyInternalClass
- Class names, method names and variable that are locally and not supposed to be used for scripting should start with underscore like _MyInternalClass
### Python code formatting tools
- flake8
- in source code directory on Linux shell
~~~
- **flake8** in source code directory on Linux shell
```bash
find src/Mod/Fem/ -name "*\.py" | grep -v InitGui.py | xargs -I [] flake8 --ignore=E266,W503 --max-line-length=100 []
~~~
```
- [LGTM](www.lgtm.com)
- TODO: check pylint
- automatic code formatter will not be used for existent code
- for new code if someone would like to use a code formatter black should be used
- Automatic code formatter will not be used for existent code
- For new code if someone would like to use a code formatter black should be used
### Coding
- print() vs. FreeCAD.Console.PrintMessage()
- FreeCAD.Console.PrintMessage() or Log or Error should be used
- print() should be used for debugging only
- forum topic https://forum.freecadweb.org/viewtopic.php?f=10&t=39110
- BTW: Console prints need a new line where as print does not need one
- `FreeCAD.Console.PrintMessage()` or Log or Error should be used
- `print()` should be used for debugging only
- [forum topic](https://forum.freecadweb.org/viewtopic.php?f=10&t=39110)
- BTW: Console prints need a new line where as print does not need one
### Documenting
- Python style is preferred over Doxygen style
- see ccx tools module in fem tools package
- see forum topic: https://forum.freecadweb.org/viewtopic.php?f=10&t=37094
Python style is preferred over Doxygen style
- see `ccx` tools module in fem tools package
- see [forum topic](https://forum.freecadweb.org/viewtopic.php?f=10&t=37094)
## C++
### Naming policy

View File

@@ -482,7 +482,7 @@ class Writer(object):
dimension = "M/L^3"
if name.startswith("Edge"):
# not tested, but it seems needed
# because denisty does not exist (IMHO, bernd)
# because density does not exist (IMHO, bernd)
density = None
if density:
density.Unit = Units.Unit(-2, 1)

View File

@@ -34,7 +34,7 @@ are supported:
- ElmerSolver
- Z88
To query settings about those solver the solver name must be given exactely in
To query settings about those solver the solver name must be given exactly in
the form written in the list above. To make the solver recognize settings for a
new solver have a look at :class:`_SolverDlg`.
"""

View File

@@ -195,7 +195,7 @@ def get_mesh_to_solve(analysis):
:returns:
A tuple ``(object, message)``. If and only if the analysis contains
exactely one mesh object the first value of the tuple is the mesh document
exactly one mesh object the first value of the tuple is the mesh document
object. Otherwise the first value is ``None`` and the second value is a
error message indicating what went wrong.
"""
@@ -235,7 +235,7 @@ def is_of_type(obj, ty):
:returns:
``True`` if *obj* is of type *ty*, ``False`` otherwise. Type must match
exactely: Derived objects are not considered to be of type of one of their
exactly: Derived objects are not considered to be of type of one of their
super classes.
"""
return type_of_obj(obj) == ty