JCSDA-internal / ioda-converters

Various converters for getting obs data in and out of IODA
8 stars 2 forks source link

Upgrade of pycodestyle from 2.8.0 to 2.11.0 reveals new coding style errors #1433

Closed srherbener closed 7 months ago

srherbener commented 7 months ago

Description

During testing of the upcoming spack-stack-1.6.0 release, I found that pycodestyle was upgraded from version 2.8.0 to 2.11.0 which resulted in flagging coding style errors in several python converters. That is, with pycodestyle@2.8.0 all converters pass but with pycodestyle@2.11.0 a handful of converters do not pass. Here's a list of the failing tests from the LastTestsFailed.log file:

 13 1836:iodaconv_compo_coding_norms
 14 1837:iodaconv_gsi_ncdiag_coding_norms
 15 1840:iodaconv_land_coding_norms
 16 1841:iodaconv_lib-python_coding_norms
 17 1842:iodaconv_marine_coding_norms
 18 1849:iodaconv_gnssro_coding_norms

With a very quick look, it appears that the new pycodestyle wants to have a space after keywords, whereas the old pycodestyle does not. Eg, if(...): is okay with 2.8.0 but is an error with 2.11.0.

Requirements

All python scripts all pass pycodestyle@2.11.0 checks.

Acceptance Criteria (Definition of Done)

All coding norms ctests pass.

Dependencies

None

srherbener commented 7 months ago

@PatNichols I made you an assignee so you are aware of this issue. I've got the run sitting in front of me and I'll just go ahead and fix the coding style errors and submit a PR since it should only take a short while.

PatNichols commented 7 months ago

@srherbener If you need me to help change code let me know. The QCFlags thing is abot to conclude for the first operator which gives me some breathing room.

srherbener commented 7 months ago

Thanks @PatNichols, for now #1434 has all the fixes for pycodestyle 2.11.0 (which pass for 2.8.0 as well).

PatNichols commented 7 months ago

@srherbener JCSDA at some point should just bless some formatters e.g. autopep8 for python and then it would be easier to correct these style errors. I did look at the documentation for pycodestyle and you can configure what's allowed and not allowed. I am assuming someone either deleted the configuration file or we just used the default for all htis time. True story, at LANL we ran clang-format on the code and diffed against the original...