0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-21 13:38:21 -05:00

chore: add pre-commit checks for writting better code

This commit is contained in:
neon_arch 2023-06-01 12:25:36 +03:00
parent 662cbcf12e
commit 8dd18ebed8
5 changed files with 88 additions and 12 deletions

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
/target /target
package.json
package-lock.json
dump.rdb dump.rdb
.vscode

5
.rusty-hook.toml Normal file
View File

@ -0,0 +1,5 @@
[hooks]
pre-commit = "cargo test && cargo fmt -- --check && cargo clippy && stylelint ./public/static/themes/*.css ./public/static/colorschemes/*.css ./public/static/*.js"
[logging]
verbose = true

13
.stylelintrc.json Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "stylelint-config-standard",
"rules": {
"alpha-value-notation": "number",
"selector-class-pattern": null
},
"overrides": [
{
"files": ["*.js"],
"customSyntax": "postcss-lit"
}
]
}

71
Cargo.lock generated
View File

@ -125,7 +125,7 @@ dependencies = [
"actix-utils", "actix-utils",
"futures-core", "futures-core",
"futures-util", "futures-util",
"mio 0.8.7", "mio 0.8.8",
"num_cpus", "num_cpus",
"socket2", "socket2",
"tokio 1.28.2", "tokio 1.28.2",
@ -438,6 +438,15 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "ci_info"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24f638c70e8c5753795cc9a8c07c44da91554a09e4cf11a7326e8161b0a3c45e"
dependencies = [
"envmnt",
]
[[package]] [[package]]
name = "cloudabi" name = "cloudabi"
version = "0.0.3" version = "0.0.3"
@ -693,6 +702,16 @@ dependencies = [
"termcolor", "termcolor",
] ]
[[package]]
name = "envmnt"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059"
dependencies = [
"fsio",
"indexmap",
]
[[package]] [[package]]
name = "errno" name = "errno"
version = "0.3.1" version = "0.3.1"
@ -796,6 +815,12 @@ dependencies = [
"percent-encoding 2.2.0", "percent-encoding 2.2.0",
] ]
[[package]]
name = "fsio"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3"
[[package]] [[package]]
name = "fuchsia-cprng" name = "fuchsia-cprng"
version = "0.1.1" version = "0.1.1"
@ -1510,9 +1535,9 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.7" version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eebffdb73fe72e917997fad08bdbf31ac50b0fa91cec93e69a0662e4264d454c" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@ -1567,6 +1592,12 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
[[package]]
name = "nias"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0"
[[package]] [[package]]
name = "nodrop" name = "nodrop"
version = "0.1.14" version = "0.1.14"
@ -1609,9 +1640,9 @@ checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.52" version = "0.10.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" checksum = "12df40a956736488b7b44fe79fe12d4f245bb5b3f5a1f6095e499760015be392"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if 1.0.0",
@ -1641,9 +1672,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.87" version = "0.9.88"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -2358,6 +2389,18 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "rusty-hook"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96cee9be61be7e1cbadd851e58ed7449c29c620f00b23df937cb9cbc04ac21a3"
dependencies = [
"ci_info",
"getopts",
"nias",
"toml",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.13" version = "1.0.13"
@ -2879,7 +2922,7 @@ dependencies = [
"autocfg 1.1.0", "autocfg 1.1.0",
"bytes 1.4.0", "bytes 1.4.0",
"libc", "libc",
"mio 0.8.7", "mio 0.8.8",
"num_cpus", "num_cpus",
"parking_lot 0.12.1", "parking_lot 0.12.1",
"pin-project-lite", "pin-project-lite",
@ -3038,6 +3081,15 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "toml"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.2" version = "0.3.2"
@ -3316,7 +3368,7 @@ dependencies = [
[[package]] [[package]]
name = "websurfx" name = "websurfx"
version = "0.11.0" version = "0.12.0"
dependencies = [ dependencies = [
"actix-files", "actix-files",
"actix-web", "actix-web",
@ -3330,6 +3382,7 @@ dependencies = [
"redis", "redis",
"reqwest 0.11.18", "reqwest 0.11.18",
"rlua", "rlua",
"rusty-hook",
"scraper", "scraper",
"serde", "serde",
"serde_json", "serde_json",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "websurfx" name = "websurfx"
version = "0.11.0" version = "0.12.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -22,3 +22,6 @@ redis = {version="*"}
md5 = {version="*"} md5 = {version="*"}
rand={version="*"} rand={version="*"}
once_cell = {version="*"} once_cell = {version="*"}
[dev-dependencies]
rusty-hook = "^0.11.2"