Skip to content

Commit

Permalink
Make Invidious compliant to Crystal 1.15 formatting rules (#5014)
Browse files Browse the repository at this point in the history
  • Loading branch information
syeopite authored Jan 22, 2025
2 parents b13f77b + 097b4f0 commit bfa6da2
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:
submodules: true

- name: Install Crystal
id: lint_step_install_crystal
uses: crystal-lang/[email protected]
with:
crystal: latest
Expand All @@ -146,7 +147,7 @@ jobs:
path: |
./lib
./bin
key: shards-${{ hashFiles('shard.lock') }}
key: shards-${{ hashFiles('shard.lock') }}-${{ steps.lint_step_install_crystal.outputs.crystal }}

- name: Install Shards
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/invidious/frontend/watch_page.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Invidious::Frontend::WatchPage
@full_videos,
@video_streams,
@audio_streams,
@captions
@captions,
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/invidious/helpers/errors.cr
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def error_json_helper(
env : HTTP::Server::Context,
status_code : Int32,
exception : Exception,
additional_fields : Hash(String, Object) | Nil = nil
additional_fields : Hash(String, Object) | Nil = nil,
)
if exception.is_a?(InfoException)
return error_json_helper(env, status_code, exception.message || "", additional_fields)
Expand All @@ -152,7 +152,7 @@ def error_json_helper(
env : HTTP::Server::Context,
status_code : Int32,
message : String,
additional_fields : Hash(String, Object) | Nil = nil
additional_fields : Hash(String, Object) | Nil = nil,
)
env.response.content_type = "application/json"
env.response.status_code = status_code
Expand Down
2 changes: 1 addition & 1 deletion src/invidious/search/filters.cr
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module Invidious::Search
@type : Type = Type::All,
@duration : Duration = Duration::None,
@features : Features = Features::None,
@sort : Sort = Sort::Relevance
@sort : Sort = Sort::Relevance,
)
end

Expand Down
2 changes: 1 addition & 1 deletion src/invidious/search/query.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module Invidious::Search
def initialize(
params : HTTP::Params,
@type : Type = Type::Regular,
@region : String? = nil
@region : String? = nil,
)
# Get the raw search query string (common to all search types). In
# Regular search mode, also look for the `search_query` URL parameter
Expand Down
2 changes: 1 addition & 1 deletion src/invidious/videos/storyboard.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Invidious::Videos

def initialize(
*, @url, @width, @height, @count, @interval,
@rows, @columns, @images_count
@rows, @columns, @images_count,
)
authority = /(i\d?).ytimg.com/.match!(@url.host.not_nil!)[1]?

Expand Down
2 changes: 1 addition & 1 deletion src/invidious/yt_backend/extractors.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ end
def extract_items(
initial_data : InitialData,
author_fallback : String? = nil,
author_id_fallback : String? = nil
author_id_fallback : String? = nil,
) : {Array(SearchItem), String?}
items = [] of SearchItem
continuation = nil
Expand Down
12 changes: 6 additions & 6 deletions src/invidious/yt_backend/youtube_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ module YoutubeAPI
def initialize(
*,
@client_type = ClientType::Web,
@region = "US"
@region = "US",
)
end

Expand Down Expand Up @@ -370,7 +370,7 @@ module YoutubeAPI
browse_id : String,
*, # Force the following parameters to be passed by name
params : String,
client_config : ClientConfig | Nil = nil
client_config : ClientConfig | Nil = nil,
)
# JSON Request data, required by the API
data = {
Expand Down Expand Up @@ -464,7 +464,7 @@ module YoutubeAPI
video_id : String,
*, # Force the following parameters to be passed by name
params : String,
client_config : ClientConfig | Nil = nil
client_config : ClientConfig | Nil = nil,
)
# Playback context, separate because it can be different between clients
playback_ctx = {
Expand Down Expand Up @@ -557,7 +557,7 @@ module YoutubeAPI
def search(
search_query : String,
params : String,
client_config : ClientConfig | Nil = nil
client_config : ClientConfig | Nil = nil,
)
# JSON Request data, required by the API
data = {
Expand All @@ -583,7 +583,7 @@ module YoutubeAPI

def get_transcript(
params : String,
client_config : ClientConfig | Nil = nil
client_config : ClientConfig | Nil = nil,
) : Hash(String, JSON::Any)
data = {
"context" => self.make_context(client_config),
Expand All @@ -605,7 +605,7 @@ module YoutubeAPI
def _post_json(
endpoint : String,
data : Hash,
client_config : ClientConfig | Nil
client_config : ClientConfig | Nil,
) : Hash(String, JSON::Any)
# Use the default client config if nil is passed
client_config ||= DEFAULT_CLIENT_CONFIG
Expand Down

0 comments on commit bfa6da2

Please sign in to comment.