mirror of
https://github.com/plausible/analytics.git
synced 2025-03-14 10:06:38 +00:00
Update credo config + extras (#3547)
* Disable CyclomaticComplexity checks * Move AuhtorizeSitesAPI plug under extra
This commit is contained in:
@ -116,7 +116,7 @@
|
||||
#
|
||||
{Credo.Check.Refactor.Apply, []},
|
||||
{Credo.Check.Refactor.CondStatements, []},
|
||||
{Credo.Check.Refactor.CyclomaticComplexity, []},
|
||||
{Credo.Check.Refactor.CyclomaticComplexity, false},
|
||||
{Credo.Check.Refactor.FunctionArity, []},
|
||||
{Credo.Check.Refactor.LongQuoteBlocks, []},
|
||||
{Credo.Check.Refactor.MatchInCondition, []},
|
||||
|
@ -36,7 +36,6 @@ defmodule Plausible.Billing.Plans do
|
||||
As new versions of plans are introduced, users who were on old plans can
|
||||
still choose from old plans.
|
||||
"""
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def growth_plans_for(%User{} = user, now \\ Timex.now()) do
|
||||
user = Plausible.Users.with_subscription(user)
|
||||
v4_available = FunWithFlags.enabled?(:business_tier, for: user)
|
||||
|
@ -20,7 +20,6 @@ defmodule Plausible.DataMigration.NumericIDs do
|
||||
|
||||
@table_settings "SETTINGS index_granularity = 8192"
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def run(opts \\ []) do
|
||||
interactive? = Keyword.get(opts, :interactive?, true)
|
||||
|
||||
|
@ -353,7 +353,7 @@ defmodule Plausible.Ingestion.Event do
|
||||
@tablet_types ["car browser", "tablet"]
|
||||
@desktop_types ["tv", "console", "desktop"]
|
||||
alias UAInspector.Result.Device
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
|
||||
defp screen_size(ua) do
|
||||
case ua.device do
|
||||
%Device{type: t} when t in @mobile_types ->
|
||||
|
@ -71,7 +71,6 @@ defmodule Plausible.Plugins.API.Token do
|
||||
end
|
||||
|
||||
@spec last_used_humanize(t()) :: String.t()
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def last_used_humanize(token) do
|
||||
diff =
|
||||
if token.last_used_at do
|
||||
|
@ -31,7 +31,6 @@ defmodule Plausible.Stats.Base do
|
||||
end
|
||||
end
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def query_events(site, query) do
|
||||
{first_datetime, last_datetime} = utc_boundaries(query, site)
|
||||
|
||||
@ -419,7 +418,6 @@ defmodule Plausible.Stats.Base do
|
||||
|> select_session_metrics(rest, query)
|
||||
end
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def dynamic_filter_condition(query, filter_key, db_field) do
|
||||
case query && query.filters && query.filters[filter_key] do
|
||||
{:is, value} ->
|
||||
|
@ -301,7 +301,6 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
end
|
||||
end
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
defp base_session_query(site, query) do
|
||||
{first_datetime, last_datetime} = utc_boundaries(query, site)
|
||||
|
||||
@ -421,7 +420,6 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
end
|
||||
end
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
defp base_query_bare(site, query) do
|
||||
{first_datetime, last_datetime} = utc_boundaries(query, site)
|
||||
|
||||
|
@ -177,7 +177,6 @@ defmodule Plausible.Stats.FilterSuggestions do
|
||||
|> wrap_suggestions()
|
||||
end
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def filter_suggestions(site, query, filter_name, filter_search) do
|
||||
filter_search = if filter_search == nil, do: "", else: filter_search
|
||||
|
||||
|
@ -54,7 +54,6 @@ defmodule Plausible.Stats.Filters do
|
||||
end
|
||||
|
||||
@non_escaped_pipe_regex ~r/(?<!\\)\|/
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
defp filter_value(key, val) do
|
||||
{is_negated, val} = parse_negated_prefix(val)
|
||||
{is_contains, val} = parse_contains_prefix(val)
|
||||
|
@ -56,7 +56,6 @@ defmodule Plausible.Stats.Imported do
|
||||
# GA only has 'source'
|
||||
def merge_imported(q, _, _, "utm_source", _), do: q
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def merge_imported(q, site, query, property, metrics)
|
||||
when property in [
|
||||
"visit:source",
|
||||
|
@ -226,7 +226,6 @@ defmodule Plausible.Stats.Timeseries do
|
||||
end
|
||||
end
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
defp empty_row(date, metrics) do
|
||||
Enum.reduce(metrics, %{date: date}, fn metric, row ->
|
||||
case metric do
|
||||
|
@ -15,7 +15,6 @@ defmodule PlausibleWeb.Components.Billing do
|
||||
attr(:size, :atom, default: :sm)
|
||||
attr(:rest, :global)
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def premium_feature_notice(assigns) do
|
||||
~H"""
|
||||
<.notice
|
||||
@ -37,7 +36,6 @@ defmodule PlausibleWeb.Components.Billing do
|
||||
attr(:resource, :string, required: true)
|
||||
attr(:rest, :global)
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
def limit_exceeded_notice(assigns) do
|
||||
~H"""
|
||||
<.notice {@rest} title="Notice">
|
||||
|
@ -627,7 +627,6 @@ defmodule PlausibleWeb.Live.ChoosePlan do
|
||||
"""
|
||||
end
|
||||
|
||||
# credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity
|
||||
defp change_plan_link_text(
|
||||
%{
|
||||
owned_plan: %Plan{kind: from_kind, monthly_pageview_limit: from_volume},
|
||||
|
Reference in New Issue
Block a user