Open-MSS / MSS

A QT application, a OGC web map server, a collaboration server to plan atmospheric research flights.
https://open-mss.github.io
Apache License 2.0
61 stars 77 forks source link

Add linting with codespell #2329

Closed matrss closed 3 months ago

matrss commented 6 months ago

We have quite a few typos/misspellings in MSS. We could introduce a spellchecker as an additional linter. codespell is one that I am aware of. This is what it finds on the current develop branch:

$ codespell --check-filenames
./CHANGES.rst:45: enhacements ==> enhancements
./CHANGES.rst:54: enhacements ==> enhancements
./CHANGES.rst:113: dislayed ==> displayed
./CHANGES.rst:276: decribed ==> described
./CHANGES.rst:439: Similiar ==> Similar
./CHANGES.rst:599: seperate ==> separate
./CHANGES.rst:622: revison ==> revision
./CHANGES.rst:663: powerfull ==> powerful
./CHANGES.rst:663: pathes ==> paths
./CHANGES.rst:736: Appeareance ==> Appearance
./CHANGES.rst:737: dissappears ==> disappears
./CHANGES.rst:746: superflous ==> superfluous
./CHANGES.rst:787: capabilty ==> capability
./CHANGES.rst:830: depency ==> dependency
./CHANGES.rst:898: whould ==> would
./CHANGES.rst:913: completly ==> completely
./CHANGES.rst:998: crashs ==> crashes
./CHANGES.rst:1016: pacakages ==> packages
./CHANGES.rst:1019: consistant ==> consistent
./CHANGES.rst:1021: transfered ==> transferred
./CHANGES.rst:1032: seperator ==> separator
./CHANGES.rst:1096: completly ==> completely
./CHANGES.rst:1244: dependend ==> dependent, depended, depend
./conftest.py:83: pathes ==> paths
./mslib/msidp/idp.py:376: metod ==> method
./mslib/msidp/idp.py:380: metod ==> method
./mslib/msidp/idp.py:994: occured ==> occurred
./mslib/msidp/idp.py:1013: occured ==> occurred
./mslib/msidp/idp_uwsgi.py:371: metod ==> method
./mslib/msidp/idp_uwsgi.py:375: metod ==> method
./mslib/msidp/idp_uwsgi.py:960: occured ==> occurred
./mslib/msidp/idp_uwsgi.py:982: occured ==> occurred
./mslib/static/docs/about.md:7: aircrafts ==> aircraft
./mslib/static/docs/about.md:9: aquisition ==> acquisition
./mslib/static/templates/user/reset_password.html:38: fpr ==> for, far, fps
./mslib/static/templates/user/reset_password.html:50: fpr ==> for, far, fps
./mslib/static/templates/idp/idp_login_success.html:13: bellow ==> below
./mslib/mscolab/file_manager.py:127: uptodate ==> up-to-date
./mslib/mscolab/file_manager.py:231: succesfull ==> successful
./mslib/mscolab/conf.py:184: initializeing ==> initializing
./mslib/mscolab/mscolab.py:309: succesfully ==> successfully
./mslib/mscolab/server.py:143: likly ==> likely
./mslib/mscolab/server.py:718: wheather ==> weather, whether
./mslib/support/qt_json_view/model.py:44: occurences ==> occurrences
./mslib/support/qt_json_view/model.py:44: occurence ==> occurrence
./mslib/utils/netCDF4tools.py:263: dictionnary ==> dictionary
./mslib/utils/config.py:154: ths ==> the, this
./mslib/utils/qt.py:318: reenable ==> re-enable
./mslib/utils/qt.py:394: itselfs ==> itself
./mslib/utils/migration/update_json_file_to_version_eight.py:93: seperate ==> separate
./mslib/utils/migration/config_before_nine.py:147: ths ==> the, this
./mslib/utils/migration/update_json_file_to_version_nine.py:74: seperate ==> separate
./mslib/msui/aircrafts.py: aircrafts ==> aircraft
./mslib/msui/aircrafts.py:4: aircrafts ==> aircraft
./mslib/msui/aircrafts.py:7: aircrafts ==> aircraft
./mslib/msui/sideview.py:316: specifiy ==> specify
./mslib/msui/wms_control.py:572: fomr ==> from, form
./mslib/msui/wms_control.py:791: implicitely ==> implicitly
./mslib/msui/wms_control.py:795: implicitely ==> implicitly
./mslib/msui/wms_control.py:796: implicitely ==> implicitly
./mslib/msui/wms_control.py:797: implicitely ==> implicitly
./mslib/msui/wms_control.py:798: implicitely ==> implicitly
./mslib/msui/wms_control.py:1044: everytime ==> every time
./mslib/msui/wms_control.py:1485: seperate ==> separate
./mslib/msui/mpl_pathinteractor.py:374: accomodate ==> accommodate
./mslib/msui/mpl_pathinteractor.py:506: disply ==> display
./mslib/msui/mpl_map.py:319: visibily ==> visibly, visibility
./mslib/msui/mscolab.py:459: occured ==> occurred
./mslib/msui/mscolab.py:460: occured ==> occurred
./mslib/msui/socket_control.py:41: editted ==> edited
./mslib/msui/mpl_qtwidget.py:314: accomodate ==> accommodate
./mslib/msui/mpl_qtwidget.py:742: als ==> also
./mslib/msui/mpl_qtwidget.py:744: als ==> also
./mslib/msui/mpl_qtwidget.py:1617: accomodate ==> accommodate
./mslib/msui/performance_settings.py:33: aircrafts ==> aircraft
./mslib/msui/performance_settings.py:39: aircrafts ==> aircraft
./mslib/msui/performance_settings.py:39: aircrafts ==> aircraft
./mslib/msui/performance_settings.py:87: informations ==> information
./mslib/msui/performance_settings.py:112: aircrafts ==> aircraft
./mslib/msui/__pycache__/aircrafts.cpython-311.pyc: aircrafts ==> aircraft
./mslib/msui/__pycache__/aircrafts.cpython-310.pyc: aircrafts ==> aircraft
./mslib/mswms/wms.py:564: seperate ==> separate
./mslib/mswms/wms.py:811: secton ==> section
./mslib/mswms/demodata.py:755: ond ==> one, and
./mslib/mswms/demodata.py:932: amout ==> amount
./mslib/mswms/mpl_hsec_styles.py:1179: PRES ==> PRESS
./mslib/mswms/mpl_hsec_styles.py:1190: PRES ==> PRESS
./mslib/mswms/mpl_hsec_styles.py:1195: hight ==> height, high
./mslib/mswms/mpl_hsec_styles.py:1197: PRES ==> PRESS
./mslib/mswms/mpl_hsec_styles.py:1232: PRES ==> PRESS
./mslib/mswms/mpl_hsec_styles.py:1287: hight ==> height, high
./mslib/mswms/mpl_hsec_styles.py:1330: occurence ==> occurrence
./mslib/mswms/mpl_vsec_styles.py:149: wether ==> weather, whether
./mslib/mswms/mpl_vsec_styles.py:1131: occurence ==> occurrence
./mslib/mswms/gallery_builder.py:485: unparseable ==> unparsable
./mslib/mswms/gallery_builder.py:543: unparseable ==> unparsable
./mslib/mswms/mpl_hsec.py:333: laoded ==> loaded
./mslib/mswms/dataaccess.py:202: concering ==> concerning
./mslib/mswms/dataaccess.py:296: unparseable ==> unparsable
./tutorials/tutorial_views.py:420: doubleClick ==> double-click
./tutorials/tutorial_views.py:426: doubleClick ==> double-click
./tutorials/tutorial_views.py:460: doubleClick ==> double-click
./tutorials/tutorial_views.py:470: doubleClick ==> double-click
./tutorials/tutorial_views.py:482: doubleClick ==> double-click
./tutorials/tutorial_views.py:485: doubleClick ==> double-click
./tutorials/tutorial_views.py:487: annother ==> another
./tutorials/tutorial_views.py:490: doubleClick ==> double-click
./tutorials/tutorial_views.py:492: doubleClick ==> double-click
./tutorials/tutorial_views.py:499: doubleClick ==> double-click
./tutorials/tutorial_views.py:506: doubleClick ==> double-click
./tutorials/tutorial_mscolab.py:40: collegues ==> colleagues
./tutorials/tutorial_mscolab.py:111: doubleClick ==> double-click
./tutorials/tutorial_mscolab.py:144: doubleClick ==> double-click
./tutorials/tutorial_mscolab.py:151: doubleClick ==> double-click
./tutorials/tutorial_mscolab.py:232: windo ==> window
./tutorials/tutorial_mscolab.py:492: doubleClick ==> double-click
./tutorials/textfiles/tutorial_wms.txt:12: informations ==> information
./tutorials/textfiles/tutorial_mscolab.txt:71: alo ==> also
./tutorials/textfiles/tutorial_mscolab.txt:110: meassage ==> message, massage
./tutorials/textfiles/tutorial_mscolab.txt:147: overwite ==> overwrite
./tutorials/textfiles/tutorial_mscolab.txt:150: overwite ==> overwrite
./tutorials/textfiles/tutorial_satellitetrack.txt:4: reffered ==> referred
./tutorials/utils/__init__.py:144: shure ==> sure
./docs/about.rst:6: aircrafts ==> aircraft
./docs/about.rst:7: aquisition ==> acquisition
./docs/mscolab.rst:57: informations ==> information
./docs/mscolab.rst:72: catagory ==> category
./docs/mscolab.rst:142: outpu ==> output
./docs/mscolab.rst:145: regulary ==> regular, regularly
./docs/sso_via_saml_mscolab.rst:325: bellow ==> below
./docs/sso_via_saml_mscolab.rst:436: descripto ==> descriptor
./docs/sso_via_saml_mscolab.rst:549: occured ==> occurred
./docs/installation.rst:9: continuos ==> continuous
./docs/installation.rst:149: itselfs ==> itself
./docs/installation.rst:166: suceeds ==> succeeds
./docs/mswms.rst:498: Instal ==> Install
./docs/mswms.rst:522: posibility ==> possibility
./docs/mswms.rst:522: Alternativly ==> Alternatively
./docs/mswms.rst:619: similiar ==> similar
./docs/development.rst:10: regulary ==> regular, regularly
./docs/development.rst:11: likly ==> likely
./docs/development.rst:150: evironments ==> environments
./docs/development.rst:285: ommitted ==> omitted
./docs/development.rst:352: aircrafts ==> aircraft
./docs/development.rst:431: regulary ==> regular, regularly
./docs/gallery/code/downloads/Side_VS_PWCB01.py:35: occurence ==> occurrence
./docs/gallery/code/downloads/Top_VIProbWCB.py:37: occurence ==> occurrence
./docs/gallery/code/downloads/Top_PVTropo01.py:54: PRES ==> PRESS
./docs/gallery/code/downloads/Top_PVTropo01.py:65: PRES ==> PRESS
./docs/gallery/code/downloads/Top_PVTropo01.py:70: hight ==> height, high
./docs/gallery/code/downloads/Top_PVTropo01.py:72: PRES ==> PRESS
./docs/gallery/code/downloads/Top_PVTropo01.py:107: PRES ==> PRESS
./docs/gallery/code/downloads/Top_ThermalTropo01.py:66: hight ==> height, high
./docs/samples/nginx/sites-available/mss_proxy.conf:9: aNULL ==> annul
./docs/samples/config/mscolab/setup_saml2_backend.py.sample:35: certiticate ==> certificate
./docs/samples/config/mscolab/setup_saml2_backend.py.sample:44: initializeing ==> initializing
./docs/samples/config/msui/performance_simple.json.sample:14: coeficients ==> coefficients
./docs/samples/config/mswms/mswms_settings.py.sample:32: amout ==> amount
./docs/samples/config/mswms/mswms_settings.py.chem_plots:33: amout ==> amount
./docs/samples/config/mswms/mss_chem_plots.py:131: nam ==> name
./docs/samples/config/mswms/mss_chem_plots.py:146: nam ==> name
./docs/samples/config/mswms/mss_chem_plots.py:154: nam ==> name
./docs/samples/config/mswms/mss_chem_plots.py:288: nam ==> name
./docs/samples/config/mswms/mss_chem_plots.py:315: nam ==> name
./docs/samples/config/mswms/mss_chem_plots.py:322: nam ==> name
./docs/samples/config/mswms/mswms_settings.py.demodata:33: amout ==> amount
./docs/samples/plugins/navaid.rst:13: requiered ==> required
./docs/samples/plugins/navaid.rst:22: ouside ==> outside
./localbuild/meta.yaml:122: possibilites ==> possibilities
./localbuild/post-link.sh:6: menue ==> menu
./tests/_test_utils/test_units.py:44: degreeE ==> degree
./tests/data/performance_simple.json:14: coeficients ==> coefficients
./tests/_test_mscolab/test_server_auth_required.py:60: unknow ==> unknown
./tests/_test_mscolab/test_sockets_manager.py:101: decription ==> description, decryption
./tests/_test_mscolab/test_sockets_manager.py:115: decription ==> description, decryption
./tests/_test_mscolab/test_sockets_manager.py:126: decription ==> description, decryption
./tests/_test_mscolab/test_sockets_manager.py:175: emmitted ==> emitted
./tests/_test_mscolab/test_sockets_manager.py:206: emmitted ==> emitted
./tests/_test_mscolab/test_file_manager.py:404: catergories ==> categories
./tests/_test_mscolab/test_files_api.py:89: absolut ==> absolute
./tests/_test_mswms/test_wms.py:173: omage ==> homage
./tests/_test_mswms/test_wms.py:228: omage ==> homage
./tests/_test_mswms/test_mss_plot_driver.py:471: PRES ==> PRESS
./tests/_test_msui/test_aircrafts.py:7: aircrafts ==> aircraft
./tests/_test_msui/test_aircrafts.py:30: aircrafts ==> aircraft
./tests/_test_msui/test_tableview.py:41: initital ==> initial

Some of these are certainly false-positives, but many aren't.

matrss commented 6 months ago

@ReimarBauer since we were already on the topic of linters, what do you think about this?

ReimarBauer commented 6 months ago

This one can be dangerous it changes also methods. There are some which needs excluded,

e.g

./tests/_test_mswms/test_mss_plot_driver.py:471: PRES ==> PRESS
. ./tests/_test_utils/test_units.py:44: degreeE ==> degree
./tutorials/tutorial_views.py:420: doubleClick ==> double-click

./docs/samples/nginx/sites-available/mss_proxy.conf:9: aNULL ==> annul

In py scripts it better would checks only comments or doc strings. Also in the conf file it would create a problem

There it catches a different problem in data or source. These are only available with docs builded. But it likly should be height ./docs/gallery/code/downloads/Top_PVTropo01.py:70: hight ==> height, high

So it is useful, but we should not trust it on everything.

matrss commented 6 months ago

Of course there are some false positives. Fixing misspellings we already have must be done in a way that it does not break anything (and if not possible we can have excludes for specific cases).

In py scripts it better would checks only comments or doc strings.

In general I think that is a good thing. Function, method and variable names should also be checked for typos and for new code there is no issue with that at all. As said above, we probably cannot fix everything we already have, but what can be fixed should be, in my opinion.

So it is useful, but we should not trust it on everything.

I am not suggesting just letting it auto-fix stuff. I am suggesting another linter workflow, like flake8, that would need to be green to merge stuff.