1
1
Fork
You've already forked ecformat
0

Set up linters and formatters #22

Manually merged
BaumiCoder merged 52 commits from feature/2-linters into main 2025年09月23日 14:07:19 +02:00

Resolves #2

User perspective

Changes only relevant for developers with the target to increase code equality, which should lead for example to less bugs.

Developer perspective

Linter and formatters for all relevant files in the project. Furthermore, also configuration to

  • run them on commit or push
  • run them after save in VSCodium for immediate feedback.

See Development.md for details.

To make all linters and formatters pass, some (automatic) formatting and refactoring was necessary. This also include a dependency upgrade, because cargo-deny founds a unmaintained indirect dependency.

Resolves #2 ### User perspective Changes only relevant for developers with the target to increase code equality, which should lead for example to less bugs. ### Developer perspective Linter and formatters for all relevant files in the project. Furthermore, also configuration to - run them on commit or push - run them after save in VSCodium for immediate feedback. See `Development.md` for details. To make all linters and formatters pass, some (automatic) formatting and refactoring was necessary. This also include a dependency upgrade, because `cargo-deny` founds a unmaintained indirect dependency.
After reading the documentation
https://rust-lang.github.io/rustfmt/?version=v1.8.0
only at these options I am not fine with the default values.
(Only considering the stable options)
rustfmt added spaces arround the "=" in line 88 but not in the similar
situations at the other #[arg(...)]. Therefore, I added them manually.
clippy considers test code only with option --all-targets
clippy considers test code only with option --all-targets
To make clear which one are in use / necessary for the project.
Schema for TOML files in project. There seems to be no schema available
for REUSE and clippy (which maybe relevant in the future).
The rust-project is for a rust-project.json file, which is used for
rust-analyzer in projects without cargo.
https://rust-analyzer.github.io/book/non_cargo_based_projects.html 
Recommend the Taplo extension
cargo aliases can only run cargo sub commands and precious does not
support all necessary linters.
There seems to be no good way to included them all into the project
as some kind of development dependency.
Licenses of currently used dependcies (+ license of project itself)
and they seem to be compatible to me.
Upgrade all dependency, so that no warnings from cargo-deny are caused
by outdated direct dependencies.
Some crates has not updated there dependencies for a while,
which cannot be fixed within the ecformat project itself.
Also using it for installation of further linter tools
Found with yamllint, which will be added to pre-commit after all
errors are fixed.
Found with yamllint, which will be added to pre-commit after all
errors are fixed.
Found with yamllint, which will be added to pre-commit after all
errors are fixed.
Fixes the warning from yamllint, which allows to run it strict now
(i.e., yamllint will also fail on warnings now).
Setting line length 100 as it should match with yamllint configuraton.
With the link to the schema, the VSCodium extension shows that
it have to be "validations" instead of "validation".
There is no schema for Forgejo, but Gitea currently seems to be similar
enough as Forgejo is a fork of Gitea.
(yamllint does not find such schema errors)
The other has not been updated since 2021 and the new one has also
support for source code comments.
There seems to be no CLI tool for LanguageTool, so use at least
a static spell checker.
"codespell" also covers strings (LTeX+ does not).
Using a REUSE installation from pre-commit for the annotation,
would need a hook for very command, but this should be never run
as git hook.
Types for some config files of the linters / formatters
themself is missing. Opened a Pull Request to add them:
https://github.com/pre-commit/identify/pull/539 
Extension for Cargo.toml editing
These options were also used earlier, directly in the justfile.
- New version of charset-normalizer-rs removes dependency
 of unmainted crate "instant"
 - Changes in Licenses of indirect dependencies
To be independent of the online source, which also allow to commit
without being connected to the internet.
Currently in development branch. Downloaded from:
4e8fa498a0/site/static/reuse-toml-v1.schema.json 
Furthermore, use "manual" stage for the execution with "just lint"
as some hooks are only used there.
For example adding a crate in a separate commit, before using it is okay.
There is no suitable type for these config files.
Therefore, I need to switch from "types_or" to "files".
BaumiCoder manually merged commit 64f034d179 into main 2025年09月23日 14:07:19 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
Compat/Breaking
Breaking change that won't be backward compatible
EditorConfig
0.17.2
Issues to support version 0.17.2 of the EditorConfig specification
Kind
Bug
Something is not working
Kind
Chore
Some tasks maintainig tasks
Kind
Documentation
Documentation changes
Kind
Enhancement
Improve existing functionality
Kind
Feature
New functionality
Kind
Testing
Issue or pull request related to testing
Packaging
About packaging the project for some platform
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
WIP
Work in progress (Assignee is working on this issue)
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BaumiCoder/ecformat!22
Reference in a new issue
BaumiCoder/ecformat
No description provided.
Delete branch "feature/2-linters"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?