diff --git a/.ruff.toml b/.ruff.toml index f159f0afca..7297311923 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -30,7 +30,6 @@ lint.ignore = [ "D102", # Missing docstring in public method "D104", # Missing docstring in public package # (D-3) Temporary, before an initial review, either fix ocurrences or move to (2). - "D100", # Missing docstring in public module "D103", # Missing docstring in public function "D200", # One-line docstring should fit on one line "D205", # 1 blank line required between summary line and description diff --git a/benchmarks/benchmarks/import_iris.py b/benchmarks/benchmarks/import_iris.py index fbae82fee6..51679ce7df 100644 --- a/benchmarks/benchmarks/import_iris.py +++ b/benchmarks/benchmarks/import_iris.py @@ -2,6 +2,9 @@ # # This file is part of Iris and is released under the BSD license. # See LICENSE in the root of the repository for full licensing details. + +"""import iris benchmarking.""" + from importlib import import_module, reload ################ diff --git a/docs/gallery_tests/test_gallery_examples.py b/docs/gallery_tests/test_gallery_examples.py index 83f2c93217..37f2858ee9 100644 --- a/docs/gallery_tests/test_gallery_examples.py +++ b/docs/gallery_tests/test_gallery_examples.py @@ -3,6 +3,8 @@ # This file is part of Iris and is released under the BSD license. # See LICENSE in the root of the repository for full licensing details. +"""Test all the gallery examples.""" + import importlib import matplotlib.pyplot as plt diff --git a/docs/src/conf.py b/docs/src/conf.py index dab4c9052d..97be2776ef 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -17,6 +17,8 @@ # serve to show the default. # ---------------------------------------------------------------------------- +"""sphinx config.""" + import datetime from importlib.metadata import version as get_version import ntpath diff --git a/docs/src/developers_guide/documenting/docstrings_attribute.py b/docs/src/developers_guide/documenting/docstrings_attribute.py index 3044145b20..9b85ecb201 100644 --- a/docs/src/developers_guide/documenting/docstrings_attribute.py +++ b/docs/src/developers_guide/documenting/docstrings_attribute.py @@ -1,3 +1,6 @@ +"""docstring attribute example.""" + + class ExampleClass: """Class Summary.""" diff --git a/docs/src/developers_guide/documenting/docstrings_sample_routine.py b/docs/src/developers_guide/documenting/docstrings_sample_routine.py index d565e6a8df..4c26bc3569 100644 --- a/docs/src/developers_guide/documenting/docstrings_sample_routine.py +++ b/docs/src/developers_guide/documenting/docstrings_sample_routine.py @@ -1,3 +1,6 @@ +"""docstring routine example.""" + + def sample_routine(arg1, arg2, kwarg1="foo", kwarg2=None): """Purpose section text goes here. diff --git a/docs/src/userguide/plotting_examples/1d_quickplot_simple.py b/docs/src/userguide/plotting_examples/1d_quickplot_simple.py index 725ff69f11..58d0918dcb 100644 --- a/docs/src/userguide/plotting_examples/1d_quickplot_simple.py +++ b/docs/src/userguide/plotting_examples/1d_quickplot_simple.py @@ -1,3 +1,5 @@ +"""Simple 1D plot using iris.quickplot.plot().""" + import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/plotting_examples/1d_simple.py b/docs/src/userguide/plotting_examples/1d_simple.py index 249412f44f..4511a0fbe1 100644 --- a/docs/src/userguide/plotting_examples/1d_simple.py +++ b/docs/src/userguide/plotting_examples/1d_simple.py @@ -1,3 +1,5 @@ +"""Simple 1D plot using iris.plot.plot().""" + import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/plotting_examples/1d_with_legend.py b/docs/src/userguide/plotting_examples/1d_with_legend.py index 6b29fc9e76..b325657766 100644 --- a/docs/src/userguide/plotting_examples/1d_with_legend.py +++ b/docs/src/userguide/plotting_examples/1d_with_legend.py @@ -1,3 +1,5 @@ +"""Simple 1D plot using iris.plot.plot() with a legend.""" + import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/plotting_examples/brewer.py b/docs/src/userguide/plotting_examples/brewer.py index 905296279d..e42ad57cc0 100644 --- a/docs/src/userguide/plotting_examples/brewer.py +++ b/docs/src/userguide/plotting_examples/brewer.py @@ -1,3 +1,5 @@ +"""Plot a chart of all Brewer colour schemes.""" + import matplotlib.pyplot as plt import numpy as np diff --git a/docs/src/userguide/plotting_examples/cube_blockplot.py b/docs/src/userguide/plotting_examples/cube_blockplot.py index 50a2d1f4d7..1f4d3985a3 100644 --- a/docs/src/userguide/plotting_examples/cube_blockplot.py +++ b/docs/src/userguide/plotting_examples/cube_blockplot.py @@ -1,3 +1,5 @@ +"""Cube block plot using using iris.plot.pcolormesh().""" + import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/plotting_examples/cube_brewer_cite_contourf.py b/docs/src/userguide/plotting_examples/cube_brewer_cite_contourf.py index 6e3996660c..4e28510e43 100644 --- a/docs/src/userguide/plotting_examples/cube_brewer_cite_contourf.py +++ b/docs/src/userguide/plotting_examples/cube_brewer_cite_contourf.py @@ -1,3 +1,5 @@ +"""Addind a citation for a plot using iris.plot.citation().""" + import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/plotting_examples/cube_brewer_contourf.py b/docs/src/userguide/plotting_examples/cube_brewer_contourf.py index d562443f07..94692c924c 100644 --- a/docs/src/userguide/plotting_examples/cube_brewer_contourf.py +++ b/docs/src/userguide/plotting_examples/cube_brewer_contourf.py @@ -1,3 +1,5 @@ +"""Plot a cube with a Brewer colour palette using iris.quickplot.contourf().""" + import matplotlib.cm as mpl_cm import matplotlib.pyplot as plt diff --git a/docs/src/userguide/plotting_examples/cube_contour.py b/docs/src/userguide/plotting_examples/cube_contour.py index 7a9fe6ef09..0d8c1e02aa 100644 --- a/docs/src/userguide/plotting_examples/cube_contour.py +++ b/docs/src/userguide/plotting_examples/cube_contour.py @@ -1,3 +1,8 @@ +"""Simple contour plot of a cube. + +Can use iris.plot.contour() or iris.quicplot.contour(). + +""" import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/plotting_examples/cube_contourf.py b/docs/src/userguide/plotting_examples/cube_contourf.py index 5989e42c71..531dd45d25 100644 --- a/docs/src/userguide/plotting_examples/cube_contourf.py +++ b/docs/src/userguide/plotting_examples/cube_contourf.py @@ -1,3 +1,8 @@ +"""Simple filled contour plot of a cube. + +Can use iris.plot.contour() or iris.quickplot.contour(). + +""" import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/regridding_plots/interpolate_column.py b/docs/src/userguide/regridding_plots/interpolate_column.py index ec1f37a3b2..681af0c998 100644 --- a/docs/src/userguide/regridding_plots/interpolate_column.py +++ b/docs/src/userguide/regridding_plots/interpolate_column.py @@ -1,3 +1,5 @@ +"""Interpolate using iris.analysis.Linear().""" + import matplotlib.pyplot as plt import numpy as np diff --git a/docs/src/userguide/regridding_plots/regridded_to_global.py b/docs/src/userguide/regridding_plots/regridded_to_global.py index 5ce6513ef0..8e43f1471a 100644 --- a/docs/src/userguide/regridding_plots/regridded_to_global.py +++ b/docs/src/userguide/regridding_plots/regridded_to_global.py @@ -1,3 +1,5 @@ +"""Interpolate using iris.analysis.Linear().""" + import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/regridding_plots/regridded_to_global_area_weighted.py b/docs/src/userguide/regridding_plots/regridded_to_global_area_weighted.py index f53e624e03..6c906ba87b 100644 --- a/docs/src/userguide/regridding_plots/regridded_to_global_area_weighted.py +++ b/docs/src/userguide/regridding_plots/regridded_to_global_area_weighted.py @@ -1,3 +1,5 @@ +"""Regrid using iris.analysis.AreaWeighted.""" + import matplotlib.colors import matplotlib.pyplot as plt import numpy as np diff --git a/docs/src/userguide/regridding_plots/regridded_to_rotated.py b/docs/src/userguide/regridding_plots/regridded_to_rotated.py index cb54a016cb..31afdb7da1 100644 --- a/docs/src/userguide/regridding_plots/regridded_to_rotated.py +++ b/docs/src/userguide/regridding_plots/regridded_to_rotated.py @@ -1,3 +1,5 @@ +"""Rotated pole.""" + import matplotlib.pyplot as plt import iris diff --git a/docs/src/userguide/regridding_plots/regridding_plot.py b/docs/src/userguide/regridding_plots/regridding_plot.py index c559e0e3e7..ed45822a51 100644 --- a/docs/src/userguide/regridding_plots/regridding_plot.py +++ b/docs/src/userguide/regridding_plots/regridding_plot.py @@ -1,3 +1,5 @@ +"""Plot regridded data.""" + import matplotlib.pyplot as plt import iris diff --git a/lib/iris/fileformats/pp_load_rules.py b/lib/iris/fileformats/pp_load_rules.py index ea42aee92c..7c164edd41 100644 --- a/lib/iris/fileformats/pp_load_rules.py +++ b/lib/iris/fileformats/pp_load_rules.py @@ -3,10 +3,11 @@ # This file is part of Iris and is released under the BSD license. # See LICENSE in the root of the repository for full licensing details. - # Historically this was auto-generated from # SciTools/iris-code-generators:tools/gen_rules.py +"""PP Load Rules.""" + import calendar from functools import wraps diff --git a/lib/iris/fileformats/pp_save_rules.py b/lib/iris/fileformats/pp_save_rules.py index ab9d1c9545..9bcfd8d92f 100644 --- a/lib/iris/fileformats/pp_save_rules.py +++ b/lib/iris/fileformats/pp_save_rules.py @@ -3,6 +3,8 @@ # This file is part of Iris and is released under the BSD license. # See LICENSE in the root of the repository for full licensing details. +"""PP Save Rules.""" + import warnings import cftime diff --git a/pyproject.toml b/pyproject.toml index d0c2816e93..37384a3c3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,6 +103,14 @@ ignore = [ force-sort-within-sections = true known-first-party = ["iris"] +[tool.ruff.lint.per-file-ignores] +# All test scripts +"test_*.py" = [ + # https://docs.astral.sh/ruff/rules/undocumented-public-module/ + "D100", # Missing docstring in public module +] + + [tool.ruff.lint.pydocstyle] convention = "numpy" diff --git a/setup.py b/setup.py index 6e58a7999d..1027085e81 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +"""Iris setup.""" + import os import sys