mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
Merge pull request #2828 from SamantazFox/add-ameba-shard
Add Ameba static code analysis tool to dev shards
This commit is contained in:
commit
b2c3d9fb0a
5 changed files with 100 additions and 2 deletions
92
.ameba.yml
Normal file
92
.ameba.yml
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#
|
||||||
|
# Lint
|
||||||
|
#
|
||||||
|
|
||||||
|
# Exclude assigns for ECR files
|
||||||
|
Lint/UselessAssign:
|
||||||
|
Excluded:
|
||||||
|
- src/invidious.cr
|
||||||
|
- src/invidious/helpers/errors.cr
|
||||||
|
- src/invidious/routes/**/*.cr
|
||||||
|
|
||||||
|
# Ignore false negative (if !db.query_one?...)
|
||||||
|
Lint/UnreachableCode:
|
||||||
|
Excluded:
|
||||||
|
- src/invidious/database/base.cr
|
||||||
|
|
||||||
|
# Ignore shadowed variable `key` (it works for now, and that's
|
||||||
|
# a sensitive part of the code)
|
||||||
|
Lint/ShadowingOuterLocalVar:
|
||||||
|
Excluded:
|
||||||
|
- src/invidious/helpers/tokens.cr
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Style
|
||||||
|
#
|
||||||
|
|
||||||
|
Style/RedundantBegin:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RedundantReturn:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Metrics
|
||||||
|
#
|
||||||
|
|
||||||
|
# Ignore function complexity (number of if/else & case/when branches)
|
||||||
|
# For some functions that can hardly be simplified for now
|
||||||
|
Metrics/CyclomaticComplexity:
|
||||||
|
Excluded:
|
||||||
|
# get_about_info(ucid, locale) => [17/10]
|
||||||
|
- src/invidious/channels/about.cr
|
||||||
|
|
||||||
|
# fetch_channel_community(ucid, continuation, ...) => [34/10]
|
||||||
|
- src/invidious/channels/community.cr
|
||||||
|
|
||||||
|
# create_notification_stream(env, topics, connection_channel) => [14/10]
|
||||||
|
- src/invidious/helpers/helpers.cr:84:5
|
||||||
|
|
||||||
|
# get_index(plural_form, count) => [25/10]
|
||||||
|
- src/invidious/helpers/i18next.cr
|
||||||
|
|
||||||
|
# call(context) => [18/10]
|
||||||
|
- src/invidious/helpers/static_file_handler.cr
|
||||||
|
|
||||||
|
# show(env) => [38/10]
|
||||||
|
- src/invidious/routes/embed.cr
|
||||||
|
|
||||||
|
# get_video_playback(env) => [45/10]
|
||||||
|
- src/invidious/routes/video_playback.cr
|
||||||
|
|
||||||
|
# handle(env) => [40/10]
|
||||||
|
- src/invidious/routes/watch.cr
|
||||||
|
|
||||||
|
# playlist_ajax(env) => [24/10]
|
||||||
|
- src/invidious/routes/playlists.cr
|
||||||
|
|
||||||
|
# fetch_youtube_comments(id, cursor, ....) => [40/10]
|
||||||
|
# template_youtube_comments(comments, locale, ...) => [16/10]
|
||||||
|
# content_to_comment_html(content) => [14/10]
|
||||||
|
- src/invidious/comments.cr
|
||||||
|
|
||||||
|
# to_json(locale, json) => [21/10]
|
||||||
|
# extract_video_info(video_id, ...) => [44/10]
|
||||||
|
# process_video_params(query, preferences) => [20/10]
|
||||||
|
- src/invidious/videos.cr
|
||||||
|
|
||||||
|
# produce_search_params(page, sort, ...) => [29/10]
|
||||||
|
# process_search_query(query, page, ...) => [14/10]
|
||||||
|
- src/invidious/search.cr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#src/invidious/playlists.cr:327:5
|
||||||
|
#[C] Metrics/CyclomaticComplexity: Cyclomatic complexity too high [19/10]
|
||||||
|
# fetch_playlist(plid : String)
|
||||||
|
|
||||||
|
#src/invidious/playlists.cr:436:5
|
||||||
|
#[C] Metrics/CyclomaticComplexity: Cyclomatic complexity too high [11/10]
|
||||||
|
# extract_playlist_videos(initial_data : Hash(String, JSON::Any))
|
|
@ -6,7 +6,7 @@ ARG release
|
||||||
WORKDIR /invidious
|
WORKDIR /invidious
|
||||||
COPY ./shard.yml ./shard.yml
|
COPY ./shard.yml ./shard.yml
|
||||||
COPY ./shard.lock ./shard.lock
|
COPY ./shard.lock ./shard.lock
|
||||||
RUN shards install
|
RUN shards install --production
|
||||||
|
|
||||||
COPY --from=quay.io/invidious/lsquic-compiled /root/liblsquic.a ./lib/lsquic/src/lsquic/ext/liblsquic.a
|
COPY --from=quay.io/invidious/lsquic-compiled /root/liblsquic.a ./lib/lsquic/src/lsquic/ext/liblsquic.a
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ ARG release
|
||||||
WORKDIR /invidious
|
WORKDIR /invidious
|
||||||
COPY ./shard.yml ./shard.yml
|
COPY ./shard.yml ./shard.yml
|
||||||
COPY ./shard.lock ./shard.lock
|
COPY ./shard.lock ./shard.lock
|
||||||
RUN shards install
|
RUN shards install --production
|
||||||
|
|
||||||
COPY --from=quay.io/invidious/lsquic-compiled /root/liblsquic.a ./lib/lsquic/src/lsquic/ext/liblsquic.a
|
COPY --from=quay.io/invidious/lsquic-compiled /root/liblsquic.a ./lib/lsquic/src/lsquic/ext/liblsquic.a
|
||||||
|
|
||||||
|
|
|
@ -48,3 +48,6 @@ shards:
|
||||||
git: https://github.com/crystal-lang/crystal-sqlite3.git
|
git: https://github.com/crystal-lang/crystal-sqlite3.git
|
||||||
version: 0.18.0
|
version: 0.18.0
|
||||||
|
|
||||||
|
ameba:
|
||||||
|
git: https://github.com/crystal-ameba/ameba.git
|
||||||
|
version: 0.14.3
|
||||||
|
|
|
@ -33,6 +33,9 @@ development_dependencies:
|
||||||
spectator:
|
spectator:
|
||||||
github: icy-arctic-fox/spectator
|
github: icy-arctic-fox/spectator
|
||||||
version: ~> 0.10.4
|
version: ~> 0.10.4
|
||||||
|
ameba:
|
||||||
|
github: crystal-ameba/ameba
|
||||||
|
version: ~> 0.14.3
|
||||||
|
|
||||||
crystal: ">= 1.0.0, < 2.0.0"
|
crystal: ">= 1.0.0, < 2.0.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue