Skip to content

Commit a1cecd4

Browse files
committed
chore: format code
format with `mix format` Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
1 parent d95b0f5 commit a1cecd4

111 files changed

Lines changed: 463 additions & 530 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/.credo.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@
8686
# You can customize the priority of any check
8787
# Priority values are: `low, normal, high, higher`
8888
#
89-
{Credo.Check.Design.AliasUsage,
90-
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
89+
{Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
9190
# You can also customize the exit_status of each check.
9291
# If you don't want TODO comments to cause `mix credo` to fail, just
9392
# set this value to 0 (zero).

backend/config/dev.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ config :azurex, Azurex.Blob.Config,
4545
api_url: "http://localhost:10000/devstoreaccount1",
4646
default_container: "edgehog",
4747
storage_account_name: "devstoreaccount1",
48-
storage_account_key:
49-
"Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
48+
storage_account_key: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
5049

5150
# Configure your database
5251
config :edgehog, Edgehog.Repo,

backend/lib/edgehog/application.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ defmodule Edgehog.Application do
5959
# Start the Campaigns supervisor
6060
Edgehog.Campaigns.Supervisor,
6161
# Start the Tenant Reconciler Supervisor
62-
{Edgehog.Tenants.Reconciler.Supervisor,
63-
tenant_to_trigger_url_fun: tenant_to_trigger_url_fun},
62+
{Edgehog.Tenants.Reconciler.Supervisor, tenant_to_trigger_url_fun: tenant_to_trigger_url_fun},
6463
# Start Containers reconciler
6564
{Registry, keys: :unique, name: Edgehog.Containers.Reconciler.Registry},
6665
# Start the Endpoint (http/https)

backend/lib/edgehog/astarte/cluster/validations/url.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ defmodule Edgehog.Astarte.Cluster.Validations.URL do
5555
end
5656
end
5757

58-
@impl Ash.Resource.Validation
58+
@impl Validation
5959
def batch_callbacks?(_changeset, _opts, _context), do: false
6060

61-
@impl Ash.Resource.Validation
61+
@impl Validation
6262
def has_batch_validate?, do: false
6363
end

backend/lib/edgehog/astarte/device/cellular_connection.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ defmodule Edgehog.Astarte.Device.CellularConnection do
5555
# type Object Aggregate.
5656
# For details, see https://github.com/astarte-platform/astarte/issues/630
5757
with {:ok, %{"data" => data}} <-
58-
AppEngine.Devices.get_datastream_data(client, device_id, @status_interface,
59-
query: [limit: 1]
60-
) do
58+
AppEngine.Devices.get_datastream_data(client, device_id, @status_interface, query: [limit: 1]) do
6159
modems = parse_status_data(data)
6260

6361
{:ok, modems}

backend/lib/edgehog/astarte/device/forwarder_session.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ defmodule Edgehog.Astarte.Device.ForwarderSession do
4848
forwarder_port,
4949
forwarder_secure_sessions?
5050
)
51-
when is_binary(session_token) and is_binary(forwarder_hostname) and
52-
is_integer(forwarder_port) and
51+
when is_binary(session_token) and is_binary(forwarder_hostname) and is_integer(forwarder_port) and
5352
is_boolean(forwarder_secure_sessions?) do
5453
data = %{
5554
session_token: session_token,

backend/lib/edgehog/astarte/device/wifi_scan_result.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ defmodule Edgehog.Astarte.Device.WiFiScanResult do
4646

4747
def get(%AppEngine{} = client, device_id) do
4848
with {:ok, %{"data" => data}} <-
49-
AppEngine.Devices.get_datastream_data(client, device_id, @interface,
50-
query: [limit: 1000]
51-
) do
49+
AppEngine.Devices.get_datastream_data(client, device_id, @interface, query: [limit: 1000]) do
5250
wifi_scan_results =
5351
data
5452
|> Map.get("ap", [])

backend/lib/edgehog/base_images/base_image/base_image.ex

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,10 @@ defmodule Edgehog.BaseImages.BaseImage do
8080
change Changes.HandleFileUpload
8181
change manage_relationship(:base_image_collection_id, :base_image_collection, type: :append)
8282

83-
change {UpsertLocalizedAttribute,
84-
input_argument: :localized_descriptions, target_attribute: :description}
83+
change {UpsertLocalizedAttribute, input_argument: :localized_descriptions, target_attribute: :description}
8584

8685
change {UpsertLocalizedAttribute,
87-
input_argument: :localized_release_display_names,
88-
target_attribute: :release_display_name}
86+
input_argument: :localized_release_display_names, target_attribute: :release_display_name}
8987
end
9088

9189
create :create_fixture do
@@ -106,12 +104,10 @@ defmodule Edgehog.BaseImages.BaseImage do
106104

107105
change manage_relationship(:base_image_collection_id, :base_image_collection, type: :append)
108106

109-
change {UpsertLocalizedAttribute,
110-
input_argument: :localized_descriptions, target_attribute: :description}
107+
change {UpsertLocalizedAttribute, input_argument: :localized_descriptions, target_attribute: :description}
111108

112109
change {UpsertLocalizedAttribute,
113-
input_argument: :localized_release_display_names,
114-
target_attribute: :release_display_name}
110+
input_argument: :localized_release_display_names, target_attribute: :release_display_name}
115111
end
116112

117113
update :update do
@@ -132,12 +128,10 @@ defmodule Edgehog.BaseImages.BaseImage do
132128

133129
accept [:starting_version_requirement]
134130

135-
change {UpsertLocalizedAttribute,
136-
input_argument: :localized_descriptions, target_attribute: :description}
131+
change {UpsertLocalizedAttribute, input_argument: :localized_descriptions, target_attribute: :description}
137132

138133
change {UpsertLocalizedAttribute,
139-
input_argument: :localized_release_display_names,
140-
target_attribute: :release_display_name}
134+
input_argument: :localized_release_display_names, target_attribute: :release_display_name}
141135
end
142136

143137
destroy :destroy do

backend/lib/edgehog/base_images/base_image/validations/base_image_not_in_use.ex

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ defmodule Edgehog.BaseImages.BaseImage.Validations.BaseImageNotInUse do
2020
@moduledoc false
2121
use Ash.Resource.Validation
2222

23+
alias Ash.Resource.Validation
2324
alias Edgehog.Campaigns.Campaign
2425

2526
require Ash.Query
2627

27-
@impl Ash.Resource.Validation
28+
@impl Validation
2829
def validate(changeset, _opts, %{tenant: tenant}) do
2930
resource = changeset.data
3031

@@ -52,15 +53,13 @@ defmodule Edgehog.BaseImages.BaseImage.Validations.BaseImageNotInUse do
5253
campaign_names = Enum.map_join(campaigns, ", ", & &1.name)
5354

5455
{:error,
55-
field: :id,
56-
message:
57-
"Base image is currently in use by the following running campaigns: #{campaign_names}"}
56+
field: :id, message: "Base image is currently in use by the following running campaigns: #{campaign_names}"}
5857
end
5958
end
6059

61-
@impl Ash.Resource.Validation
60+
@impl Validation
6261
def batch_callbacks?(_changeset, _opts, _context), do: false
6362

64-
@impl Ash.Resource.Validation
63+
@impl Validation
6564
def has_batch_validate?, do: false
6665
end

backend/lib/edgehog/campaigns/campaign/changes/compute_campaign_targets.ex

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ defmodule Edgehog.Campaigns.Campaign.Changes.ComputeCampaignTargets do
7878
end
7979
end
8080

81-
defp resolve_target_devices(changeset, action, mechanism, tenant)
82-
when action in @deployment_mechanisms do
81+
defp resolve_target_devices(changeset, action, mechanism, tenant) when action in @deployment_mechanisms do
8382
with {:ok, release} <- fetch_release(changeset, mechanism, tenant),
8483
{:ok, channel} <- fetch_channel(changeset, tenant) do
8584
devices =
@@ -111,16 +110,14 @@ defmodule Edgehog.Campaigns.Campaign.Changes.ComputeCampaignTargets do
111110
defp fetch_base_image(changeset, campaign_mechanism, tenant) do
112111
with {:error, _reason} <-
113112
Ash.get(BaseImage, campaign_mechanism.base_image_id, tenant: tenant) do
114-
{:error,
115-
Ash.Changeset.add_error(changeset, field: :base_image_id, message: "could not be found")}
113+
{:error, Ash.Changeset.add_error(changeset, field: :base_image_id, message: "could not be found")}
116114
end
117115
end
118116

119117
defp fetch_release(changeset, campaign_mechanism, tenant) do
120118
with {:error, _reason} <-
121119
Ash.get(Release, campaign_mechanism.release_id, tenant: tenant) do
122-
{:error,
123-
Ash.Changeset.add_error(changeset, field: :release_id, message: "could not be found")}
120+
{:error, Ash.Changeset.add_error(changeset, field: :release_id, message: "could not be found")}
124121
end
125122
end
126123

0 commit comments

Comments
 (0)