aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/lint
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-11 19:45:17 +0900
committernsfisis <nsfisis@gmail.com>2026-05-11 19:45:17 +0900
commit24cc697a9cd0dcac854359d65b8265f02f483b72 (patch)
treec9693dbf3136d840157609161a3a5695828e853b /scripts/lint
parent2aceeb116150b6d6e6d3f371c2af509902ceafea (diff)
downloadphp-mozart-24cc697a9cd0dcac854359d65b8265f02f483b72.tar.gz
php-mozart-24cc697a9cd0dcac854359d65b8265f02f483b72.tar.zst
php-mozart-24cc697a9cd0dcac854359d65b8265f02f483b72.zip
chore(lint): add Ruby linter scripts and apply rules
Adds scripts/lint with linters for mod.rs naming, contiguous use blocks, use-as aliasing, sorted Cargo dependencies, std::collections maps, and workspace dependency requirements. Renames mod.rs files, reorders use statements, drops unnecessary import aliases, and sorts Cargo.toml entries to satisfy the new rules.
Diffstat (limited to 'scripts/lint')
-rwxr-xr-xscripts/lint27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/lint b/scripts/lint
new file mode 100755
index 0000000..59bdcf3
--- /dev/null
+++ b/scripts/lint
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+
+require 'pathname'
+
+LINTERS = [
+ :cargo_workspace_dependencies,
+ :contiguous_use_block,
+ # TODO: re-enable this linter
+ # :no_decorative_section_comment,
+ :no_mod_rs,
+ # TODO: re-enable this linter
+ # :no_std_collections_maps,
+ :no_use_as_alias,
+ :sorted_dependencies,
+]
+
+root_dir = Pathname.new(__dir__).join('..').expand_path
+
+results = LINTERS.map do |linter|
+ require_relative "linters/#{linter}"
+ puts "===== #{linter} ====="
+ ok = send(linter, root_dir)
+ puts "Passed." if ok
+ puts
+ ok
+end
+exit(results.all? ? 0 : 1)