PyCQA / docformatter

Formats docstrings to follow PEP 257
https://pypi.python.org/pypi/docformatter
MIT License
548 stars 69 forks source link

Differing behavior between linux and macos #285

Open pavelzw opened 5 months ago

pavelzw commented 5 months ago
if __name__ == "__main__":
    """Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaa┘."""
    # This is a comment

docformatter -i test.py on macOS (arm) results in no changes being made. docformatter -i test.py on linux aarch64 results in the following changes:

if __name__ == "__main__":
    """Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaa┘."""

    # This is a comment

Repeatedly executing docformatter -i on linux adds another line on every call which breaks idempotency.

if __name__ == "__main__":
    """Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaa┘."""

    # This is a comment

This might be related to being in the string.

breaking env on linux:

(base) mambauser@79d93f1c012c:/mnt/abc$ micromamba list -p /home/mambauser/.cache/pre-commit/repotqc_4xjd/conda-default
List of packages in environment: "/home/mambauser/.cache/pre-commit/repotqc_4xjd/conda-default"

  Name                   Version   Build               Channel    
────────────────────────────────────────────────────────────────────
  _openmp_mutex          4.5       2_gnu               conda-forge
  bzip2                  1.0.8     h31becfc_5          conda-forge
  ca-certificates        2024.6.2  hcefe29a_0          conda-forge
  charset-normalizer     3.3.2     pyhd8ed1ab_0        conda-forge
  docformatter           1.7.5     pyhd8ed1ab_0        conda-forge
  ld_impl_linux-aarch64  2.40      h9fc2d93_7          conda-forge
  libexpat               2.6.2     h2f0025b_0          conda-forge
  libffi                 3.4.2     h3557bc0_5          conda-forge
  libgcc-ng              14.1.0    he277a41_0          conda-forge
  libgomp                14.1.0    he277a41_0          conda-forge
  libnsl                 2.0.1     h31becfc_0          conda-forge
  libsqlite              3.46.0    hf51ef55_0          conda-forge
  libuuid                2.38.1    hb4cce97_0          conda-forge
  libxcrypt              4.4.36    h31becfc_1          conda-forge
  libzlib                1.3.1     h68df207_1          conda-forge
  ncurses                6.5       h0425590_0          conda-forge
  openssl                3.3.1     h68df207_1          conda-forge
  pip                    24.0      pyhd8ed1ab_0        conda-forge
  python                 3.12.4    h829453d_0_cpython  conda-forge
  readline               8.2       h8fc344f_1          conda-forge
  setuptools             70.1.1    pyhd8ed1ab_0        conda-forge
  tk                     8.6.13    h194ca79_0          conda-forge
  tomli                  2.0.1     pyhd8ed1ab_0        conda-forge
  tzdata                 2024a     h0c530f3_0          conda-forge
  untokenize             0.1.1     py_0                conda-forge
  wheel                  0.43.0    pyhd8ed1ab_1        conda-forge
  xz                     5.2.6     h9cdd2b7_0          conda-forge

working env on macos:

❯ micromamba list -p /Users/pavel/.cache/pre-commit/repox0xmrc5j/conda-default
List of packages in environment: "/Users/pavel/.cache/pre-commit/repox0xmrc5j/conda-default"

  Name                Version       Build               Channel    
─────────────────────────────────────────────────────────────────────
  bzip2               1.0.8         h93a5062_5          conda-forge
  ca-certificates     2024.2.2      hf0a4a13_0          conda-forge
  charset-normalizer  3.3.2         pyhd8ed1ab_0        conda-forge
  docformatter        1.7.5         pyhd8ed1ab_0        conda-forge
  libexpat            2.6.2         hebf3989_0          conda-forge
  libffi              3.4.2         h3422bc3_5          conda-forge
  libsqlite           3.45.2        h091b4b1_0          conda-forge
  libzlib             1.2.13        h53f4e23_5          conda-forge
  ncurses             6.4.20240210  h078ce10_0          conda-forge
  openssl             3.2.1         h0d3ecfb_1          conda-forge
  pip                 24.0          pyhd8ed1ab_0        conda-forge
  python              3.12.2        hdf0ec26_0_cpython  conda-forge
  readline            8.2           h92ec313_1          conda-forge
  setuptools          69.2.0        pyhd8ed1ab_0        conda-forge
  tk                  8.6.13        h5083fa2_1          conda-forge
  tomli               2.0.1         pyhd8ed1ab_0        conda-forge
  tzdata              2024a         h0c530f3_0          conda-forge
  untokenize          0.1.1         py_0                conda-forge
  wheel               0.43.0        pyhd8ed1ab_0        conda-forge
  xz                  5.2.6         h57fd34a_0          conda-forge