Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-Push git hook #34

Merged
merged 2 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .rusty-hook.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[hooks]
pre-push = "cargo fmt --all -- --check --color always"

[logging]
verbose = true
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ serde_path_to_error = "0.1.16"
percent-encoding = "2.3.1"
hex = "0.4.3"
itertools = "0.13.0"

[dev-dependencies]
rusty-hook = "0.11.2"
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand Down
4 changes: 2 additions & 2 deletions src/api/middleware/authentication.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use poem::{Endpoint, http::StatusCode, Middleware, Request};
use poem::{http::StatusCode, Endpoint, Middleware, Request};
use sqlx::MySqlPool;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion src/api/middleware/current_user.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand Down
2 changes: 1 addition & 1 deletion src/api/middleware/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand Down
8 changes: 4 additions & 4 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use poem::{
EndpointExt,
IntoResponse,
listener::TcpListener,
middleware::{NormalizePath, TrailingSlash}, Route, Server, web::Json,
middleware::{NormalizePath, TrailingSlash},
web::Json,
EndpointExt, IntoResponse, Route, Server,
};
use serde_json::json;
use sqlx::MySqlPool;
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/auth/login.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/auth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/auth/register.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/followers.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use chorus::types::{
AddFollowingChannelSchema, FollowedChannel, jwt::Claims, Snowflake, WebhookType,
jwt::Claims, AddFollowingChannelSchema, FollowedChannel, Snowflake, WebhookType,
};
use poem::{
handler,
IntoResponse,
web::{Data, Json, Path},
IntoResponse,
};
use sqlx::MySqlPool;

Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/invites.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use chorus::types::{CreateChannelInviteSchema, Snowflake};
use chorus::types::jwt::Claims;
use poem::{handler, IntoResponse};
use chorus::types::{CreateChannelInviteSchema, Snowflake};
use poem::web::{Data, Json, Path};
use poem::{handler, IntoResponse};
use sqlx::MySqlPool;

use crate::database::entities::Channel;
Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/messages/bulk_delete.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -8,8 +8,8 @@ use chorus::types::{Rights, Snowflake};
use poem::{
handler,
http::StatusCode,
IntoResponse,
Response, web::{Data, Json, Path},
web::{Data, Json, Path},
IntoResponse, Response,
};
use sqlx::MySqlPool;

Expand Down
4 changes: 2 additions & 2 deletions src/api/routes/channels/messages/id/ack.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -7,8 +7,8 @@
use chorus::types::{jwt::Claims, Snowflake};
use poem::{
handler,
IntoResponse,
web::{Data, Json, Path},
IntoResponse,
};
use serde_json::json;
use sqlx::MySqlPool;
Expand Down
4 changes: 2 additions & 2 deletions src/api/routes/channels/messages/id/crosspost.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -7,8 +7,8 @@
use chorus::types::{jwt::Claims, MessageSendSchema, Snowflake};
use poem::{
handler,
IntoResponse,
web::{Data, Json, Path},
IntoResponse,
};
use sqlx::MySqlPool;

Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/messages/id/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -8,8 +8,8 @@ use chorus::types::{jwt::Claims, MessageModifySchema, Rights, Snowflake};
use poem::{
handler,
http::StatusCode,
IntoResponse,
Response, web::{Data, Json, Path},
web::{Data, Json, Path},
IntoResponse, Response,
};
use sqlx::MySqlPool;

Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/messages/id/reactions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -7,8 +7,8 @@
use chorus::types::{jwt::Claims, PartialEmoji, Reaction, ReactionQuerySchema, Snowflake};
use poem::{
handler,
IntoResponse,
Response, web::{Data, Json, Path, Query},
web::{Data, Json, Path, Query},
IntoResponse, Response,
};
use reqwest::StatusCode;
use sqlx::MySqlPool;
Expand Down
8 changes: 4 additions & 4 deletions src/api/routes/channels/messages/mod.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use chorus::types::{
GetChannelMessagesSchema, jwt::Claims, MessageSendSchema,
MessageType, Rights, Snowflake, types::guild_configuration::GuildFeatures,
jwt::Claims, types::guild_configuration::GuildFeatures, GetChannelMessagesSchema,
MessageSendSchema, MessageType, Rights, Snowflake,
};
use poem::{
handler,
IntoResponse,
web::{Data, Json, Path, Query},
IntoResponse,
};
use sqlx::MySqlPool;

Expand Down
10 changes: 5 additions & 5 deletions src/api/routes/channels/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use chorus::types::{ChannelModifySchema, jwt::Claims, Snowflake};
use chorus::types::{jwt::Claims, ChannelModifySchema, Snowflake};
use poem::{
delete, get, handler, IntoResponse, post,
put,
Route, web::{Data, Json, Path},
delete, get, handler, post, put,
web::{Data, Json, Path},
IntoResponse, Route,
};
use sqlx::MySqlPool;

Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/permissions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -8,8 +8,8 @@ use chorus::types::{jwt::Claims, PermissionOverwrite, PermissionOverwriteType, S
use poem::{
handler,
http::StatusCode,
IntoResponse,
Response, web::{Data, Json, Path},
web::{Data, Json, Path},
IntoResponse, Response,
};
use sqlx::MySqlPool;

Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/pins.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -8,8 +8,8 @@ use chorus::types::{jwt::Claims, Snowflake};
use poem::{
handler,
http::StatusCode,
IntoResponse,
Response, web::{Data, Json, Path},
web::{Data, Json, Path},
IntoResponse, Response,
};
use sqlx::MySqlPool;

Expand Down
8 changes: 4 additions & 4 deletions src/api/routes/channels/recipients.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use chorus::types::{ChannelType, jwt::Claims, Snowflake};
use chorus::types::{jwt::Claims, ChannelType, Snowflake};
use poem::{
handler,
http::StatusCode,
IntoResponse,
Response, web::{Data, Json, Path},
web::{Data, Json, Path},
IntoResponse, Response,
};
use sqlx::MySqlPool;

Expand Down
6 changes: 3 additions & 3 deletions src/api/routes/channels/typing.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -7,8 +7,8 @@
use chorus::types::{jwt::Claims, Snowflake};
use poem::{
handler,
IntoResponse,
Response, web::{Data, Path},
web::{Data, Path},
IntoResponse, Response,
};
use reqwest::StatusCode;
use sqlx::MySqlPool;
Expand Down
4 changes: 2 additions & 2 deletions src/api/routes/channels/webhooks.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -7,8 +7,8 @@
use chorus::types::{CreateWebhookSchema, Snowflake, WebhookType};
use poem::{
handler,
IntoResponse,
web::{Data, Json, Path},
IntoResponse,
};
use sqlx::MySqlPool;

Expand Down
4 changes: 2 additions & 2 deletions src/api/routes/guilds/id/audit_log.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
Expand All @@ -7,8 +7,8 @@
use chorus::types::{AuditLogObject, GetAuditLogsQuery, PermissionFlags, Snowflake};
use poem::{
handler,
IntoResponse,
web::{Data, Json, Path, Query},
IntoResponse,
};
use sqlx::MySqlPool;

Expand Down
10 changes: 5 additions & 5 deletions src/api/routes/guilds/id/bans.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

use chorus::types::{
GuildBanBulkCreateSchema, GuildBanCreateSchema, GuildBansQuery, GuildBansSearchQuery,
jwt::Claims, Snowflake,
jwt::Claims, GuildBanBulkCreateSchema, GuildBanCreateSchema, GuildBansQuery,
GuildBansSearchQuery, Snowflake,
};
use poem::{
handler,
IntoResponse,
Response, web::{Data, Json, Path, Query},
web::{Data, Json, Path, Query},
IntoResponse, Response,
};
use reqwest::StatusCode;
use sqlx::MySqlPool;
Expand Down
Loading