All Projects → wafflespeanut → rust-sorty

wafflespeanut / rust-sorty

Licence: MPL-2.0 license
A Rust lint to help with the sorting of uses, mods & crate declarations [OUTDATED]

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rust-sorty

lisk-template
📄 Template repository for Lisk projects
Stars: ✭ 39 (+160%)
Mutual labels:  lint
ngx-translate-lint
Simple CLI tools for check `ngx-translate` keys
Stars: ✭ 25 (+66.67%)
Mutual labels:  lint
NaturalSort.Extension
🔀 Extension method for StringComparison that adds support for natural sorting (e.g. "abc1", "abc2", "abc10" instead of "abc1", "abc10", "abc2").
Stars: ✭ 94 (+526.67%)
Mutual labels:  sorting
nano-staged
Tiny tool to run commands for modified, staged, and committed files in a GIT repository.
Stars: ✭ 347 (+2213.33%)
Mutual labels:  lint
DSA--GeeksForGeeks
DSA course solutions in C++ Jump to below directly for more problems
Stars: ✭ 47 (+213.33%)
Mutual labels:  sorting
stylelint-config
Sharable stylelint config used by GitHub's CSS
Stars: ✭ 194 (+1193.33%)
Mutual labels:  lint
lint-checks
A set of opinionated and useful lint checks
Stars: ✭ 61 (+306.67%)
Mutual labels:  lint
node-actionlint
Run actionlint from Node.js
Stars: ✭ 18 (+20%)
Mutual labels:  lint
flexlint
A flexible linter with rules defined by regular expression
Stars: ✭ 19 (+26.67%)
Mutual labels:  lint
docker-ansible
Alpine-based multistage-build version of Ansible for reproducible usage in CI
Stars: ✭ 168 (+1020%)
Mutual labels:  lint
walter.cr
Keep your crystal clean!
Stars: ✭ 14 (-6.67%)
Mutual labels:  lint
luli
A static analysis and linter tool for Lua
Stars: ✭ 45 (+200%)
Mutual labels:  lint
PixelGlitch
Image glitch visualization using various Pixel Sorting methods for Processing
Stars: ✭ 25 (+66.67%)
Mutual labels:  sorting
yamburger
YAML syntax got you down? That's a YAMBURGER!
Stars: ✭ 32 (+113.33%)
Mutual labels:  lint
sorting-visualizer
Sorting Algorithms Visualizer
Stars: ✭ 429 (+2760%)
Mutual labels:  sorting
Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
Stars: ✭ 394 (+2526.67%)
Mutual labels:  lint
actionlint
Static checker for GitHub Actions workflow files
Stars: ✭ 1,385 (+9133.33%)
Mutual labels:  lint
lint-html-with-css
Lint HTML with CSS. A collection of CSS snippets from the hashtag #lintHTMLwithCSS on twitter. These CSS snippets intend to warn developers about common mistakes made in HTML.
Stars: ✭ 35 (+133.33%)
Mutual labels:  lint
git-commit-lint-vscode
vscode一款git 规范化提交插件
Stars: ✭ 33 (+120%)
Mutual labels:  lint
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-6.67%)
Mutual labels:  lint

rust-sorty

Build Status Current Version

A lint to help with sorting the extern crate, mod and use declarations, according to the style rules. Have a look at the detailed example for a start! I guess it will be very handy for large projects written in Rust (well, at least once!).

And yeah, this should actually be done by rustfmt, but it doesn't have this option for now. So, this plugin would serve until rustfmt becomes intelligent enough to detect the unsorted declarations.

Usage

Add this to your Cargo.toml...

sorty = "0.1"

... and then to the top of the main module you wanna check,

#![feature(plugin)]
#![plugin(sorty)]

(It can show warnings or errors based on your choice, just like any other lint)

#![deny(unsorted_declarations)]         // throw errors! (poor choice for styling lints)

#![warn(unsorted_declarations)]         // show warnings (default)

#![allow(unsorted_declarations)]        // stay quiet!

Remove it once you've done all the checks, when you'll no longer be needing the plugin!

I was just kidding. I'll be very happy if you just keep it :)

Note:

This is a compiler lint, and it's unstable. So, make sure you're using the latest nightly Rust. Though this lint shows an output of the lexicographically sorted declarations, it follows some rules:

  • stuff with #[macro_use] are sorted and moved to the top, since macros become visible to the surroundings only after their declaration, unlike others.
  • pub declarations (of uses & mods) are sorted and moved to the bottom
  • self in use lists are moved to the left (other list items are sorted as usual)

Also, note that there are some stuff that aren't tracked (for now). It includes comments, spaces, etc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].