Skip to content

feat: Add linting and formating config#488

Draft
munechika-koyo wants to merge 2 commits into
cherab:developmentfrom
munechika-koyo:feature/ruff-lint-format
Draft

feat: Add linting and formating config#488
munechika-koyo wants to merge 2 commits into
cherab:developmentfrom
munechika-koyo:feature/ruff-lint-format

Conversation

@munechika-koyo

@munechika-koyo munechika-koyo commented Oct 16, 2025

Copy link
Copy Markdown
Member

Motivation

To maintain clear and readable code, we should use linting and formatting settings.

Tools to adopt

  • ruff — Python de fact standard linter/formatter
  • cython-lint — Cython linter
  • dprint — code formatting platform mainly to format yaml, json, markdown files

pre-commit tool

  • lefthook — Git hooks manager to execute all of the above checks before commit or when CI runs.

Note

I assume that these tools can be managed by a package management system like pixi. (#489)

Finally, I would be happy to discuss the most appropriate approach for cherab developers.

@jacklovell

Copy link
Copy Markdown
Member

I suggest adding Pylint to the list. Here's a minimal pylintrc file I use with Cherab:

[MAIN]

extension-pkg-allow-list=cherab,raysect,numpy,scipy
py-version=3.9  # Oldest supported by raysect 0.9
ignore-patterns=.*test.*.py  # Lots of noise in test files

[MESSAGES CONTROL]
# Disable checks which produce lots of warnings without affecting code quality.
disable=consider-using-f-string,
        missing-module-docstring,
        missing-function-docstring,
        line-too-long,
        missing-final-newline,

These can also go in pyproject.toml under the headings tool.pylint.MAIN and tool.pylint."MESSAGES CONTROL"

Added new linting rules and configuration for ruff.
Use ruff's rules for docstring lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants