Commit graph

15732 commits

Author SHA1 Message Date
Haelwenn (lanodan) Monnier
0de1a7629c
Maps: Add filter_empty_values/1 2024-01-26 16:18:29 +01:00
feld
626c22961f Merge branch 'dialyzer-fixes' into 'develop'
More dialyzer fixes

See merge request pleroma/pleroma!4042
2024-01-23 00:16:55 +00:00
Mark Felder
3a8594e927 MastodonAPI.Controller.StatusController: fix dialyzer error
lib/pleroma/web/mastodon_api/controllers/status_controller.ex:333:pattern_match
The pattern can never match the type.

Pattern:
{:ok, _activity}

Type:
{:error, _}
2024-01-22 18:37:29 -05:00
Mark Felder
138b3cb608 Clear up missing function dialyzer errors for :eldap 2024-01-22 18:37:29 -05:00
Mark Felder
115b2ad638 MRF.KeywordPolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/keyword_policy.ex:13:neg_guard_fail
Guard test:
not is_binary(_string :: binary())

can never succeed.
2024-01-22 18:37:29 -05:00
Mark Felder
0dd65246ea MRF.HashtagPolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex:87:exact_eq
The test <<_::32>> == <<_::48>> can never evaluate to 'true'.
2024-01-22 18:37:19 -05:00
Mark Felder
5f71928f6b MRF.InlineQuotePolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/inline_quote_policy.ex:60:callback_type_mismatch
Type mismatch for @callback config_description/0 in Pleroma.Web.ActivityPub.MRF.Policy behaviour.

Expected type:
%{
  :description => binary(),
  :key => atom(),
  :label => binary(),
  :related_policy => binary(),
  :children => [map()]
}

Actual type:
%{
  :children => [
    %{
      :description => <<_::808>>,
      :key => :template,
      :suggestions => [any(), ...],
      :type => :string
    },
    ...
  ],
  :description => <<_::336>>,
  :key => :mrf_inline_quote,
  :label => <<_::184>>,
  :related_policy => <<_::360>>,
  :type => :group
}
2024-01-22 18:37:13 -05:00
Mark Felder
a7fa6f18dc Pleroma.Migrators.Support.BaseMigrator: Fix dialyzer errors
lib/pleroma/migrators/context_objects_deletion_migrator.ex:13:exact_eq
The test :error | float() == 0 can never evaluate to 'true'.

lib/pleroma/migrators/hashtags_table_migrator.ex:13:exact_eq
The test :error | float() == 0 can never evaluate to 'true'.
2024-01-22 18:37:13 -05:00
Mark Felder
6ce7011a2e Pleroma.Gun.ConnectionPool.WorkerSupervisor: fix dialyzer error
lib/pleroma/gun/connection_pool/worker_supervisor.ex:24:guard_fail
The guard clause:

when _ :: true === nil

can never succeed.
2024-01-22 18:37:13 -05:00
Mark Felder
65d49ac090 Pleroma.HTTP.AdapterHelper: fix dialyzer errors
lib/pleroma/http/adapter_helper.ex:18:unknown_type
Unknown type: Connection.host/0.

lib/pleroma/http/adapter_helper.ex:19:unknown_type
Unknown type: Connection.host/0.

lib/pleroma/http/adapter_helper.ex:19:unknown_type
Unknown type: Connection.proxy_type/0.
2024-01-22 18:37:13 -05:00
Mark Felder
c74c5f479a Pleroma.Migrators.Support.BaseMigratorState: fix dialyzer error
lib/pleroma/migrators/support/base_migrator_state.ex:10:unknown_type
Unknown type: Pleroma.DataMigration.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
36355d3ed9 Pleroma.Web.ActivityPub.Builder: fix dialyzer error
lib/pleroma/web/activity_pub/builder.ex:205:unknown_type
Unknown type: Pleroma.Web.CommonAPI.ActivityDraft.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
39da451b6d Pleroma.Web.ActivityPub.Builder: fix dialyzer errors
lib/pleroma/web/activity_pub/builder.ex:35:unknown_type
Unknown type: Activity.t/0.

lib/pleroma/web/activity_pub/builder.ex:40:unknown_type
Unknown type: Activity.t/0.

lib/pleroma/web/activity_pub/builder.ex:144:unknown_type
Unknown type: Activity.t/0.
________________________________________________________________________________
lib/pleroma/web/activity_pub/builder.ex:204:unknown_type
Unknown type: Pleroma.Web.CommonAPI.ActivityDraft.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
10f3a2833f Pleroma.User.Query: fix dialyzer error
lib/pleroma/user/query.ex:74:unknown_type
Unknown type: Query.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
40feac086f Pleroma.User: fix dialyzer errors
lib/pleroma/user.ex:1514:unknown_type
Unknown type: Pleroma.UserRelationship.t/0.

lib/pleroma/user.ex:2629:unknown_type
Unknown type: Pleroma.UserRelationship.t/0.

lib/pleroma/user.ex:2638:unknown_type
Unknown type: Pleroma.UserRelationship.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
1361856213 Pleroma.User.Backup: fix some dialyzer errors
lib/pleroma/user/backup.ex:207:call
The function call will not succeed.

:zip.create(
  string(),
  [:"\"actor.json\"", :"\"outbox.json\"", :"\"likes.json\"", :"\"bookmarks.json\""],
  [{:cwd, binary()}, ...]
)

will never return since the success typing is:
(
  atom() | [atom() | [any()] | char()],
  [
    atom()
    | [atom() | [any()] | char()]
    | {atom() | [atom() | [any()] | char()], binary()}
    | {atom() | [atom() | [any()] | char()], binary(),
       {:file_info, :undefined | non_neg_integer(),
        :device | :directory | :other | :regular | :symlink | :undefined,
        :none | :read | :read_write | :undefined | :write,
        :undefined | non_neg_integer() | {_, _}, :undefined | non_neg_integer() | {_, _},
        :undefined | non_neg_integer() | {_, _}, :undefined | non_neg_integer(),
        :undefined | non_neg_integer(), :undefined | non_neg_integer(),
        :undefined | non_neg_integer(), :undefined | non_neg_integer(),
        :undefined | non_neg_integer(), :undefined | non_neg_integer()}}
  ],
  [
    :cooked
    | :memory
    | :verbose
    | {:comment, string()}
    | {:compress, :all | [[any()]] | {:add, [any()]} | {:del, [any()]}}
    | {:cwd, string()}
    | {:uncompress, :all | [[any()]] | {:add, [any()]} | {:del, [any()]}}
  ]
) ::
  {:error, _}
  | {:ok,
     atom() | [atom() | [any()] | char()] | {atom() | [atom() | [any()] | char()], binary()}}

and the contract is
(name, fileList, options) :: retValue
when name: :file.name(),
     fileList: [:FileSpec],
     fileSpec:
       :file.name() | {:file.name(), binary()} | {:file.name(), binary(), :file.file_info()},
     options: [:Option],
     option: create_option(),
     retValue:
       {:ok, FileName :: filename()}
       | {:ok, {FileName :: filename(), binary()}}
       | {:error, Reason :: term()}
2024-01-22 18:37:13 -05:00
Mark Felder
bff47479a7 Exile: fix for MacOS dev environments 2024-01-22 18:37:13 -05:00
Mark Felder
38ebefce9c Announcement: fix dialyzer errors and add typespec for the changeset
It was possible for this to raise (no_local_return) because the data key could be missing from the params
2024-01-22 18:37:13 -05:00
Mark Felder
eb4dd50f53 Use config to control inclusion of test emoji 2024-01-22 18:37:13 -05:00
Mark Felder
6df93e61c4 Use config to determine sending to the streamer registry instead of MIX_ENV compile time function definition 2024-01-22 18:37:13 -05:00
Mark Felder
653b14e1c7 Use config to control Uploader callback timeout 2024-01-22 18:37:13 -05:00
Mark Felder
8efae57d67 Dialyzer: suppress Mix.Task errors
Callback info about the 'Elixir.Mix.Task' behaviour is not available.
2024-01-22 18:37:13 -05:00
feld
f7b3681eb0 Merge branch 'exile-macos' into 'develop'
Exile: fix for MacOS dev environments

See merge request pleroma/pleroma!4041
2024-01-22 21:11:38 +00:00
Mark Felder
1632a3fec9 Exile: fix for MacOS dev environments 2024-01-22 15:35:12 -05:00
feld
d802e65cd3 Merge branch 'exile-bsds' into 'develop'
Exile: switch to fork with BSD compile fix

See merge request pleroma/pleroma!4040
2024-01-22 18:59:59 +00:00
Mark Felder
fff235433e Exile: switch to fork with BSD compile fix 2024-01-22 13:44:20 -05:00
lain
52aadc09e9 Merge branch 'exile' into 'develop'
Replace custom fifo implementation with Exile

See merge request pleroma/pleroma!4039
2024-01-22 16:49:30 +00:00
Mark Felder
0ac010ba3f Replace custom fifo implementation with Exile
This is for streaming media to ffmpeg thumbnailer. The existing implementation relies on undocumented behavior.

Erlang open_port/2 does not officially support passing a string of a file path for opening. The specs clearly state you are to provide one of the following for open_port/2:

    {spawn, Command :: string() | binary()} |
    {spawn_driver, Command :: string() | binary()} |
    {spawn_executable, FileName :: file:name_all()} |
    {fd, In :: integer() >= 0, Out :: integer() >= 0}

Our method technically works but is strongly discouraged as it can block the scheduler and dialyzer throws errors as it recognizes we're breaking the contract and some of the functions we wrote may never return.

This is indirectly covered by the Erlang FAQ section "9.12 Why can't I open devices (e.g. a serial port) like normal files?"
https://www.erlang.org/faq/problems#idm1127
2024-01-22 10:13:17 -05:00
feld
548434f85c Merge branch 'new-pipelines' into 'develop'
Fix testing cache policy, really.

See merge request pleroma/pleroma!4038
2024-01-21 04:36:24 +00:00
Mark Felder
951a82f2d7 Fix testing cache policy 2024-01-21 04:35:31 +00:00
feld
12b689a81e Merge branch 'new-pipelines' into 'develop'
Fix testing cache policy

See merge request pleroma/pleroma!4037
2024-01-21 04:34:06 +00:00
Mark Felder
badd7654fd Fix testing cache policy 2024-01-21 04:29:13 +00:00
feld
931fa4cb78 Merge branch 'new-pipelines' into 'develop'
New CI pipelines

See merge request pleroma/pleroma!4036
2024-01-21 04:17:51 +00:00
Mark Felder
518ddd458c Clarify formatting and cycles versions 2024-01-21 04:14:41 +00:00
Mark Felder
8f0051d739 Rename 1.15 image to include otp25, clarify test names 2024-01-21 04:10:20 +00:00
Mark Felder
058fa5471a Fix the image name 2024-01-21 04:06:17 +00:00
Mark Felder
aee971bd26 Only need amd64 for now 2024-01-21 03:59:26 +00:00
Mark Felder
06813d4a0e Reorganize ci scripts 2024-01-21 03:58:53 +00:00
Mark Felder
68f421c203 Use our own 1.15 ci-base image 2024-01-20 22:53:07 -05:00
Mark Felder
1790400313 Add Dialyxir with manual job execution 2024-01-20 22:49:37 -05:00
Mark Felder
06ac829eb4 Spec building should be in build stage 2024-01-20 22:45:29 -05:00
Mark Felder
df31ec0d52 Linting as a separate stage 2024-01-20 22:43:41 -05:00
Mark Felder
a0518a4ee1 Add a build and test pipeline for elixir 1.15 with a new naming convention 2024-01-20 22:37:38 -05:00
feld
1edfce4322 Merge branch 'dialyzer-fixes' into 'develop'
Dialyzer fixes

See merge request pleroma/pleroma!4035
2024-01-21 00:54:25 +00:00
Mark Felder
dcd0102800 Credo 2024-01-20 19:39:13 -05:00
Mark Felder
cca9d6aeaa Dialyzer fixes 2024-01-20 19:29:29 -05:00
Mark Felder
2330100371 Use config to control starting all HTTP pools in test env 2024-01-20 19:10:57 -05:00
Mark Felder
17877f612e Use config to control streamer registry 2024-01-20 18:51:20 -05:00
Mark Felder
4bb57d4f25 Use config to control background migrators 2024-01-20 18:47:25 -05:00
Mark Felder
c7eda0b24a Use config to control loading of custom modules 2024-01-20 18:43:53 -05:00