mirror of
https://github.com/mirego/accent.git
synced 2024-09-11 10:55:28 +03:00
Add Credo.Check.Readability.AliasOrder to credo config
This commit is contained in:
parent
7718d612aa
commit
dbbadab99e
@ -17,7 +17,7 @@
|
||||
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
|
||||
{Credo.Check.Design.TagTODO},
|
||||
{Credo.Check.Design.TagFIXME},
|
||||
{Credo.Check.Readability.AliasOrder, false},
|
||||
{Credo.Check.Readability.AliasOrder},
|
||||
{Credo.Check.Readability.FunctionNames},
|
||||
{Credo.Check.Readability.LargeNumbers},
|
||||
{Credo.Check.Readability.MaxLineLength, max_length: 200},
|
||||
@ -40,9 +40,8 @@
|
||||
{Credo.Check.Refactor.NegatedConditionsWithElse},
|
||||
{Credo.Check.Refactor.Nesting},
|
||||
{Credo.Check.Refactor.UnlessWithElse},
|
||||
{CredoEnvvar.Check.Warning.EnvironmentVariablesAtCompileTime},
|
||||
{Credo.Check.Warning.IExPry},
|
||||
{Credo.Check.Warning.IoInspect, false},
|
||||
{Credo.Check.Warning.IoInspect},
|
||||
{Credo.Check.Warning.OperationOnSameValues},
|
||||
{Credo.Check.Warning.BoolOperationOnSameValues},
|
||||
{Credo.Check.Warning.UnusedEnumOperation},
|
||||
@ -50,7 +49,8 @@
|
||||
{Credo.Check.Warning.UnusedListOperation},
|
||||
{Credo.Check.Warning.UnusedStringOperation},
|
||||
{Credo.Check.Warning.UnusedTupleOperation},
|
||||
{Credo.Check.Warning.OperationWithConstantResult}
|
||||
{Credo.Check.Warning.OperationWithConstantResult},
|
||||
{CredoEnvvar.Check.Warning.EnvironmentVariablesAtCompileTime}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -2,8 +2,8 @@ defmodule Accent.UserAuthFetcher do
|
||||
import Ecto.Query, only: [from: 2]
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Collaborator,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
defmodule Accent.UserRemote.Authenticator do
|
||||
alias Accent.UserRemote.{Fetcher, Persister, TokenGiver, CollaboratorNormalizer}
|
||||
alias Accent.UserRemote.{CollaboratorNormalizer, Fetcher, Persister, TokenGiver}
|
||||
|
||||
def authenticate(provider, uid) do
|
||||
provider
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule Accent.UserRemote.CollaboratorNormalizer do
|
||||
import Ecto.Query, only: [from: 2]
|
||||
|
||||
alias Accent.{Repo, User, Collaborator}
|
||||
alias Accent.{Collaborator, Repo, User}
|
||||
|
||||
@spec normalize(User.t()) :: :ok
|
||||
def normalize(%User{id: id, email: email}) do
|
||||
|
@ -12,8 +12,8 @@ defmodule Accent.UserRemote.Persister do
|
||||
- Existing user but with a different provider. (Login with a different provider)
|
||||
|
||||
"""
|
||||
alias Accent.Repo
|
||||
alias Accent.AuthProvider
|
||||
alias Accent.Repo
|
||||
alias Accent.User, as: RepoUser
|
||||
alias Accent.UserRemote.Adapter.User, as: FetchedUser
|
||||
alias Ecto.Changeset
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule Accent.BadgeGenerator do
|
||||
alias Accent.{
|
||||
Revision,
|
||||
PrettyFloat,
|
||||
Revision,
|
||||
TranslationsCounter
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
defmodule Accent.CollaboratorCreator do
|
||||
alias Accent.{Repo, Collaborator, User}
|
||||
alias Accent.{Collaborator, Repo, User}
|
||||
|
||||
def create(params) do
|
||||
%Collaborator{}
|
||||
|
@ -1,5 +1,5 @@
|
||||
defmodule Accent.CollaboratorUpdater do
|
||||
alias Accent.{Repo, Collaborator}
|
||||
alias Accent.{Collaborator, Repo}
|
||||
|
||||
def update(collaborator, params) do
|
||||
collaborator
|
||||
|
@ -1,5 +1,5 @@
|
||||
defmodule Accent.IntegrationManager do
|
||||
alias Accent.{Repo, Integration}
|
||||
alias Accent.{Integration, Repo}
|
||||
|
||||
import Ecto.Changeset
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule Accent.OperationBatcher do
|
||||
import Ecto.Query, only: [from: 2]
|
||||
|
||||
alias Accent.{Repo, Operation}
|
||||
alias Accent.{Operation, Repo}
|
||||
|
||||
@time_limit 60
|
||||
@time_unit "minute"
|
||||
|
@ -1,6 +1,6 @@
|
||||
defmodule Accent.RevisionDeleter do
|
||||
alias Ecto.Multi
|
||||
alias Accent.Repo
|
||||
alias Ecto.Multi
|
||||
|
||||
def delete(revision: %{master: true}), do: {:error, "can't delete master language"}
|
||||
|
||||
|
@ -2,16 +2,16 @@ defmodule Accent.GraphQL.Helpers.Authorization do
|
||||
import Accent.GraphQL.Plugins.Authorization
|
||||
|
||||
alias Accent.{
|
||||
Project,
|
||||
Version,
|
||||
Translation,
|
||||
Revision,
|
||||
Collaborator,
|
||||
TranslationCommentsSubscription,
|
||||
Document,
|
||||
Operation,
|
||||
Integration,
|
||||
Repo
|
||||
Operation,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
Translation,
|
||||
TranslationCommentsSubscription,
|
||||
Version
|
||||
}
|
||||
|
||||
def viewer_authorize(action, func) do
|
||||
|
@ -10,7 +10,6 @@ defmodule Accent.GraphQL.Resolvers.Activity do
|
||||
Plugs.GraphQLContext,
|
||||
Project,
|
||||
Repo,
|
||||
Operation,
|
||||
Translation
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
defmodule Accent.GraphQL.Resolvers.Collaborator do
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Collaborator,
|
||||
CollaboratorCreator,
|
||||
CollaboratorUpdater,
|
||||
Hook,
|
||||
Plugs.GraphQLContext
|
||||
Plugs.GraphQLContext,
|
||||
Project,
|
||||
Repo
|
||||
}
|
||||
|
||||
@typep collaborator_operation :: {:ok, %{collaborator: Collaborator.t() | nil, errors: [String.t()] | nil}}
|
||||
|
@ -2,13 +2,13 @@ defmodule Accent.GraphQL.Resolvers.Comment do
|
||||
alias Accent.Scopes.Comment, as: CommentScope
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Comment,
|
||||
Translation,
|
||||
Project,
|
||||
Hook,
|
||||
GraphQL.Paginated,
|
||||
Plugs.GraphQLContext
|
||||
Hook,
|
||||
Plugs.GraphQLContext,
|
||||
Project,
|
||||
Repo,
|
||||
Translation
|
||||
}
|
||||
|
||||
@typep comment_operation :: {:ok, %{comment: Comment.t() | nil, errors: [String.t()] | nil}}
|
||||
|
@ -1,9 +1,9 @@
|
||||
defmodule Accent.GraphQL.Resolvers.Integration do
|
||||
alias Accent.{
|
||||
Project,
|
||||
Integration,
|
||||
IntegrationManager,
|
||||
Plugs.GraphQLContext
|
||||
Plugs.GraphQLContext,
|
||||
Project
|
||||
}
|
||||
|
||||
@typep integration_operation :: {:ok, %{integration: Integration.t() | nil, errors: [String.t()] | nil}}
|
||||
|
@ -1,9 +1,9 @@
|
||||
defmodule Accent.GraphQL.Resolvers.Language do
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Language,
|
||||
GraphQL.Paginated,
|
||||
Plugs.GraphQLContext
|
||||
Language,
|
||||
Plugs.GraphQLContext,
|
||||
Repo
|
||||
}
|
||||
|
||||
alias Accent.Scopes.Language, as: LanguageScope
|
||||
|
@ -1,8 +1,8 @@
|
||||
defmodule Accent.GraphQL.Resolvers.Permission do
|
||||
alias Accent.{
|
||||
User,
|
||||
Plugs.GraphQLContext,
|
||||
Project,
|
||||
Plugs.GraphQLContext
|
||||
User
|
||||
}
|
||||
|
||||
@spec list_viewer(User.t(), any(), GraphQLContext.t()) :: {:ok, [atom()]}
|
||||
|
@ -4,14 +4,14 @@ defmodule Accent.GraphQL.Resolvers.Project do
|
||||
alias Accent.Scopes.Project, as: ProjectScope
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
GraphQL.Paginated,
|
||||
Plugs.GraphQLContext,
|
||||
Project,
|
||||
ProjectCreator,
|
||||
ProjectUpdater,
|
||||
ProjectDeleter,
|
||||
User,
|
||||
GraphQL.Paginated,
|
||||
Plugs.GraphQLContext
|
||||
ProjectUpdater,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
alias Ecto.Query
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule Accent.GraphQL.Resolvers.Role do
|
||||
alias Accent.{
|
||||
Role,
|
||||
Plugs.GraphQLContext
|
||||
Plugs.GraphQLContext,
|
||||
Role
|
||||
}
|
||||
|
||||
@spec list(any(), map(), GraphQLContext.t()) :: {:ok, list(Role.t())}
|
||||
|
@ -1,9 +1,9 @@
|
||||
defmodule Accent.GraphQL.Resolvers.TranslationCommentSubscription do
|
||||
alias Accent.{
|
||||
Plugs.GraphQLContext,
|
||||
Repo,
|
||||
Translation,
|
||||
TranslationCommentsSubscription,
|
||||
Plugs.GraphQLContext
|
||||
TranslationCommentsSubscription
|
||||
}
|
||||
|
||||
@typep translation_comments_subscription_operation :: {:ok, %{translation_comments_subscription: TranslationCommentsSubscription.t() | nil, errors: [String.t()] | nil}}
|
||||
|
@ -9,8 +9,8 @@ defmodule Accent.GraphQL.Resolvers.Version do
|
||||
Version
|
||||
}
|
||||
|
||||
alias Movement.Context
|
||||
alias Movement.Builders.NewVersion, as: NewVersionBuilder
|
||||
alias Movement.Context
|
||||
alias Movement.Persisters.NewVersion, as: NewVersionPersister
|
||||
|
||||
@typep version_operation :: {:ok, %{version: Version.t() | nil, errors: [String.t()] | nil}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule Accent.GraphQL.Resolvers.Viewer do
|
||||
alias Accent.{
|
||||
User,
|
||||
Plugs.GraphQLContext
|
||||
Plugs.GraphQLContext,
|
||||
User
|
||||
}
|
||||
|
||||
@spec show(nil, map(), GraphQLContext.t()) :: {:ok, User.t() | nil}
|
||||
|
@ -2,10 +2,10 @@ defmodule Accent.Hook.Consumers.Email do
|
||||
use Accent.Hook.EventConsumer, subscribe_to: [Accent.Hook.Producers.Email]
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
ProjectInviteEmail,
|
||||
CreateCommentEmail,
|
||||
Hook
|
||||
Hook,
|
||||
ProjectInviteEmail,
|
||||
Repo
|
||||
}
|
||||
|
||||
@supported_events ~w(create_collaborator create_comment)
|
||||
|
@ -1,9 +1,12 @@
|
||||
defmodule Accent.Hook.Consumers.Slack do
|
||||
use Accent.Hook.EventConsumer, subscribe_to: [Accent.Hook.Producers.Slack]
|
||||
|
||||
require Ecto.Query
|
||||
import Ecto.Query
|
||||
|
||||
alias Accent.{Repo, Hook}
|
||||
alias Accent.{
|
||||
Hook.Context,
|
||||
Repo
|
||||
}
|
||||
|
||||
@headers [{"Content-Type", "application/json"}]
|
||||
@service "slack"
|
||||
@ -19,9 +22,9 @@ defmodule Accent.Hook.Consumers.Slack do
|
||||
{:noreply, [], state}
|
||||
end
|
||||
|
||||
defp filter_event(%Hook.Context{event: event}), do: event in @supported_events
|
||||
defp filter_event(%Context{event: event}), do: event in @supported_events
|
||||
|
||||
defp handle_event(context = %Hook.Context{event: event, project: project}, {:http_client, http_client}) do
|
||||
defp handle_event(context = %Context{event: event, project: project}, {:http_client, http_client}) do
|
||||
with integrations <- filter_service_integration_events(project, event, @service),
|
||||
urls <- Enum.map(integrations, fn integration -> integration.data.url end),
|
||||
body <- build_body(context) do
|
||||
@ -29,7 +32,7 @@ defmodule Accent.Hook.Consumers.Slack do
|
||||
end
|
||||
end
|
||||
|
||||
defp build_body(%Hook.Context{event: "sync", user: user, payload: %{document_path: document_path, batch_operation_stats: stats}}) do
|
||||
defp build_body(%Context{event: "sync", user: user, payload: %{document_path: document_path, batch_operation_stats: stats}}) do
|
||||
%{
|
||||
text: """
|
||||
*#{user.fullname}* just synced a file: _#{document_path}_
|
||||
@ -49,7 +52,7 @@ defmodule Accent.Hook.Consumers.Slack do
|
||||
defp filter_service_integration_events(project, event, service) do
|
||||
project
|
||||
|> Ecto.assoc(:integrations)
|
||||
|> Ecto.Query.where(service: ^service)
|
||||
|> where(service: ^service)
|
||||
|> Repo.all()
|
||||
|> Enum.filter(fn integration -> event in integration.events end)
|
||||
end
|
||||
|
@ -1,8 +1,8 @@
|
||||
defmodule Accent.Hook.Consumers.Websocket do
|
||||
use Accent.Hook.EventConsumer, subscribe_to: [Accent.Hook.Producers.Websocket]
|
||||
|
||||
alias Accent.User
|
||||
alias Accent.Hook
|
||||
alias Accent.User
|
||||
|
||||
@channel "projects:"
|
||||
@supported_events ~w(sync create_collaborator create_comment)
|
||||
|
@ -1,5 +1,5 @@
|
||||
defmodule Accent.Hook.Context do
|
||||
alias Accent.{User, Project}
|
||||
alias Accent.{Project, User}
|
||||
|
||||
defstruct project: %Project{}, event: "", user: %User{}, payload: %{}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
defmodule Langue.Formatter.CSV.Parser do
|
||||
@behaviour Langue.Formatter.Parser
|
||||
|
||||
alias Langue.Formatter.SerializerResult, as: Input
|
||||
alias Langue.Formatter.ParserResult, as: Output
|
||||
alias Langue.Formatter.SerializerResult, as: Input
|
||||
|
||||
@spec parse(Input.t()) :: Output.t()
|
||||
def parse(%Input{render: input}) do
|
||||
|
@ -1,8 +1,8 @@
|
||||
defmodule Langue.Formatter.SimpleJson.Serializer do
|
||||
@behaviour Langue.Formatter.Serializer
|
||||
|
||||
alias Langue.Utils.NestedSerializerHelper
|
||||
alias Langue.Formatter.Json.Serializer, as: JsonSerializer
|
||||
alias Langue.Utils.NestedSerializerHelper
|
||||
|
||||
def serialize(%{entries: entries}) do
|
||||
render =
|
||||
|
@ -1,6 +1,6 @@
|
||||
defmodule Langue.Formatter.Parser do
|
||||
alias Langue.Formatter.SerializerResult, as: Input
|
||||
alias Langue.Formatter.ParserResult, as: Output
|
||||
alias Langue.Formatter.SerializerResult, as: Input
|
||||
|
||||
@type result :: {:ok, Output.t()} | {:error, any()}
|
||||
|
||||
|
@ -3,9 +3,9 @@ defmodule Movement.Builders.DocumentDelete do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.{Repo, Translation, Project}
|
||||
alias Accent.{Project, Repo, Translation}
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
|
||||
@action "remove"
|
||||
|
||||
|
@ -3,10 +3,10 @@ defmodule Movement.Builders.NewSlave do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.Scopes.Revision, as: RevisionScope
|
||||
alias Accent.{Translation, Revision, Repo}
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.{Repo, Revision, Translation}
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
|
||||
@action "new"
|
||||
|
||||
|
@ -3,9 +3,9 @@ defmodule Movement.Builders.NewVersion do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.{Translation, Repo}
|
||||
alias Accent.{Repo, Translation}
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
|
||||
@action "version_new"
|
||||
|
||||
|
@ -3,9 +3,9 @@ defmodule Movement.Builders.RevisionCorrectAll do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.{Repo, Translation}
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
|
||||
@action "correct_conflict"
|
||||
|
||||
|
@ -3,10 +3,9 @@ defmodule Movement.Builders.RevisionMerge do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.EntriesCommitProcessor
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.Repo
|
||||
alias Accent.Translation
|
||||
alias Accent.{Repo, Translation}
|
||||
alias Movement.EntriesCommitProcessor
|
||||
|
||||
def build(context) do
|
||||
context
|
||||
|
@ -3,10 +3,9 @@ defmodule Movement.Builders.RevisionSync do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.EntriesCommitProcessor
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.Repo
|
||||
alias Accent.Translation
|
||||
alias Accent.{Repo, Translation}
|
||||
alias Movement.EntriesCommitProcessor
|
||||
|
||||
def build(context) do
|
||||
context
|
||||
|
@ -3,9 +3,9 @@ defmodule Movement.Builders.RevisionUncorrectAll do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.{Repo, Translation}
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
|
||||
@action "uncorrect_conflict"
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
defmodule Movement.Builders.Rollback do
|
||||
@behaviour Movement.Builder
|
||||
|
||||
alias Movement.Operation
|
||||
alias Accent.PreviousTranslation
|
||||
alias Movement.Operation
|
||||
|
||||
@action "rollback"
|
||||
|
||||
|
@ -3,9 +3,9 @@ defmodule Movement.Builders.SlaveConflictSync do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
alias Accent.Scopes.Translation, as: TranslationScope
|
||||
alias Accent.{Repo, Translation}
|
||||
alias Movement.Mappers.Operation, as: OperationMapper
|
||||
|
||||
@included_actions ~w(conflict_on_corrected conflict_on_proposed)
|
||||
@action "conflict_on_slave"
|
||||
|
@ -1,5 +1,5 @@
|
||||
defmodule Movement.Comparer do
|
||||
alias Movement.Comparers.{SyncSmart, SyncPassive, MergeSmart, MergeForce, MergePassive}
|
||||
alias Movement.Comparers.{MergeForce, MergePassive, MergeSmart, SyncPassive, SyncSmart}
|
||||
|
||||
@callback compare(map, map) :: Movement.Operation.t()
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
defmodule Movement.EctoMigrationHelper do
|
||||
alias Movement.Migration
|
||||
alias Accent.Repo
|
||||
alias Movement.Migration
|
||||
|
||||
@doc """
|
||||
Update given model by merging the existing parameters and the arguments.
|
||||
|
@ -1,5 +1,6 @@
|
||||
defmodule Movement.Migration.Conflict do
|
||||
@behaviour Movement.Migration
|
||||
|
||||
import Movement.EctoMigrationHelper
|
||||
|
||||
def call(:correct, operation) do
|
||||
|
@ -3,7 +3,7 @@ defmodule Movement.Migration.Translation do
|
||||
|
||||
import Movement.EctoMigrationHelper
|
||||
|
||||
alias Accent.{Translation, Operation}
|
||||
alias Accent.{Operation, Translation}
|
||||
|
||||
def call(:update_proposed, operation) do
|
||||
operation.translation
|
||||
|
@ -20,7 +20,8 @@ defmodule Movement.Migrator do
|
||||
"""
|
||||
|
||||
import Movement.Migrator.Macros
|
||||
alias Movement.Migration.{Conflict, Translation, Rollback}
|
||||
|
||||
alias Movement.Migration.{Conflict, Rollback, Translation}
|
||||
|
||||
def up(operations) when is_list(operations), do: Enum.map(operations, &up/1)
|
||||
def down(operations) when is_list(operations), do: Enum.map(operations, &down/1)
|
||||
|
@ -1,9 +1,9 @@
|
||||
defmodule Movement.Persisters.Base do
|
||||
require Ecto.Query
|
||||
|
||||
alias Movement.Migrator
|
||||
alias Accent.{Operation, Repo}
|
||||
alias Movement.Mappers.OperationsStats, as: StatMapper
|
||||
alias Accent.{Repo, Operation}
|
||||
alias Movement.Migrator
|
||||
|
||||
# Inserts operations by batch of 500 to prevent parameters
|
||||
# overflow in database adapter
|
||||
|
@ -1,9 +1,8 @@
|
||||
defmodule Movement.Persisters.NewSlave do
|
||||
@behaviour Movement.Persister
|
||||
|
||||
alias Accent.Repo
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
alias Accent.{Repo, Revision}
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
|
||||
@batch_action "new_slave"
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
defmodule Movement.Persisters.NewVersion do
|
||||
@behaviour Movement.Persister
|
||||
|
||||
alias Accent.Repo
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
alias Accent.{Repo, Version}
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
|
||||
@batch_action "create_version"
|
||||
|
||||
|
@ -3,9 +3,8 @@ defmodule Movement.Persisters.ProjectSync do
|
||||
|
||||
import Movement.Context, only: [assign: 3]
|
||||
|
||||
alias Accent.Repo
|
||||
alias Accent.{Project, Repo}
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
alias Accent.{Repo, Project}
|
||||
|
||||
@batch_action "sync"
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
defmodule Movement.Persisters.Rollback do
|
||||
@behaviour Movement.Persister
|
||||
|
||||
alias Accent.Repo
|
||||
alias Accent.{Operation, Repo}
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
alias Accent.{Repo, Operation}
|
||||
|
||||
def persist(%Movement.Context{operations: []}), do: {:ok, []}
|
||||
|
||||
|
@ -15,6 +15,7 @@ defmodule Accent.PrettyFloat do
|
||||
28
|
||||
"""
|
||||
|
||||
def convert(integer) when is_integer(integer), do: integer
|
||||
def convert(float) when trunc(float) == float, do: trunc(float)
|
||||
def convert(float), do: float
|
||||
end
|
||||
|
@ -4,10 +4,19 @@ defmodule Accent.ExportController do
|
||||
import Canary.Plugs
|
||||
import Accent.Plugs.RevisionIdFromProjectLanguage
|
||||
|
||||
alias Accent.Scopes.Translation, as: Scope
|
||||
alias Accent.Scopes.Document, as: DocumentScope
|
||||
alias Accent.Scopes.Translation, as: Scope
|
||||
alias Accent.Scopes.Version, as: VersionScope
|
||||
alias Accent.{Repo, Project, Language, Document, Revision, Translation, Version}
|
||||
|
||||
alias Accent.{
|
||||
Document,
|
||||
Language,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
Translation,
|
||||
Version
|
||||
}
|
||||
|
||||
plug(Plug.Assign, %{canary_action: :export_revision})
|
||||
plug(:load_resource, model: Project, id_name: "project_id")
|
||||
|
@ -8,8 +8,8 @@ defmodule Accent.MergeController do
|
||||
alias Movement.Persisters.RevisionMerge, as: RevisionMergePersister
|
||||
|
||||
alias Accent.{
|
||||
Project,
|
||||
Language,
|
||||
Project,
|
||||
Revision
|
||||
}
|
||||
|
||||
|
@ -4,16 +4,15 @@ defmodule Accent.PeekController do
|
||||
import Canary.Plugs
|
||||
import Accent.Plugs.RevisionIdFromProjectLanguage
|
||||
|
||||
alias Movement.Builders.ProjectSync, as: ProjectSyncBuilder
|
||||
alias Movement.Builders.RevisionMerge, as: RevisionMergeBuilder
|
||||
|
||||
alias Accent.{
|
||||
Language,
|
||||
Project,
|
||||
Revision,
|
||||
Language
|
||||
Revision
|
||||
}
|
||||
|
||||
alias Accent.Hook.Context, as: HookContext
|
||||
alias Movement.Builders.ProjectSync, as: ProjectSyncBuilder
|
||||
alias Movement.Builders.RevisionMerge, as: RevisionMergeBuilder
|
||||
|
||||
plug(Plug.Assign, [canary_action: :peek_merge] when action === :merge)
|
||||
plug(Plug.Assign, [canary_action: :peek_sync] when action === :sync)
|
||||
|
@ -3,11 +3,11 @@ defmodule Accent.Plugs.EnsureUnlockedFileOperations do
|
||||
|
||||
def init(_), do: nil
|
||||
|
||||
def call(conn, _) do
|
||||
if conn.assigns[:project].locked_file_operations do
|
||||
conn |> send_resp(:forbidden, "File operations are locked") |> halt
|
||||
else
|
||||
conn
|
||||
end
|
||||
def call(conn = %{assigns: %{project: %{locked_file_operations: true}}}, _) do
|
||||
conn
|
||||
|> send_resp(:forbidden, "File operations are locked")
|
||||
|> halt()
|
||||
end
|
||||
|
||||
def call(conn, _), do: conn
|
||||
end
|
||||
|
@ -8,7 +8,6 @@ defmodule Accent.Plugs.GraphQLContext do
|
||||
def init(opts), do: opts
|
||||
|
||||
def call(conn, _) do
|
||||
conn
|
||||
|> put_private(:absinthe, %{context: %{conn: conn}})
|
||||
put_private(conn, :absinthe, %{context: %{conn: conn}})
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule Accent.Plugs.MovementContextParser do
|
||||
use Plug.Builder
|
||||
|
||||
alias Accent.{Repo, Document}
|
||||
alias Accent.{Document, Repo}
|
||||
alias Accent.Scopes.Document, as: DocumentScope
|
||||
alias Movement.Context
|
||||
|
||||
|
@ -1,16 +1,19 @@
|
||||
defmodule Accent.Plugs.RevisionIdFromProjectLanguage do
|
||||
alias Accent.Repo
|
||||
alias Accent.Revision
|
||||
import Plug.Conn
|
||||
|
||||
alias Accent.{Repo, Revision}
|
||||
|
||||
def fetch_revision_id_from_project_language(conn = %{assigns: %{language: language, project: project}}, _) do
|
||||
case Repo.get_by(Revision, language_id: language.id, project_id: project.id) do
|
||||
Revision
|
||||
|> Repo.get_by(language_id: language.id, project_id: project.id)
|
||||
|> case do
|
||||
%Revision{id: id} ->
|
||||
%{conn | params: Map.put(conn.params, "revision_id", id)}
|
||||
put_in(conn, [Access.key(:params, %{}), "revision_id"], id)
|
||||
|
||||
nil ->
|
||||
conn
|
||||
|> Plug.Conn.send_resp(:not_found, "")
|
||||
|> Plug.Conn.halt()
|
||||
|> send_resp(:not_found, "")
|
||||
|> halt()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,10 +4,10 @@ defmodule AccentTest.UserRemote.Authenticator do
|
||||
alias Accent.UserRemote.Authenticator
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Collaborator,
|
||||
Language,
|
||||
Project,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@ defmodule AccentTest.UserRemote.Fetcher do
|
||||
|
||||
import Mock
|
||||
|
||||
alias Accent.UserRemote.Fetcher
|
||||
alias Accent.UserRemote.Adapter.User
|
||||
alias Accent.UserRemote.Fetcher
|
||||
|
||||
defp mock_response(status, body) do
|
||||
%HTTPoison.Response{status_code: status, body: body}
|
||||
|
@ -1,11 +1,11 @@
|
||||
defmodule AccentTest.UserRemote.Persister do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Accent.AuthProvider
|
||||
alias Accent.Repo
|
||||
alias Accent.User
|
||||
alias Accent.AuthProvider
|
||||
alias Accent.UserRemote.Persister
|
||||
alias Accent.UserRemote.Adapter.User, as: UserFromFetcher
|
||||
alias Accent.UserRemote.Persister
|
||||
|
||||
@user %UserFromFetcher{email: "test@test.com", provider: "google", uid: "1234"}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
defmodule AccentTest.UserRemote.TokenGiver do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Accent.AccessToken
|
||||
alias Accent.Repo
|
||||
alias Accent.User
|
||||
alias Accent.AccessToken
|
||||
alias Accent.UserRemote.TokenGiver
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
@ -5,12 +5,12 @@ defmodule AccentTest.BadgeGenerator do
|
||||
|
||||
alias Accent.{
|
||||
BadgeGenerator,
|
||||
Repo,
|
||||
Document,
|
||||
Language,
|
||||
Project,
|
||||
Document,
|
||||
Translation,
|
||||
Revision
|
||||
Repo,
|
||||
Revision,
|
||||
Translation
|
||||
}
|
||||
|
||||
setup do
|
||||
|
@ -2,18 +2,18 @@ defmodule AccentTest.GraphQL.Helpers.Authorization do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
ProjectCreator,
|
||||
Collaborator,
|
||||
User,
|
||||
Language,
|
||||
Document,
|
||||
GraphQL.Helpers.Authorization,
|
||||
Integration,
|
||||
Language,
|
||||
Operation,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
Translation,
|
||||
TranslationCommentsSubscription,
|
||||
Version,
|
||||
Operation,
|
||||
GraphQL.Helpers.Authorization
|
||||
User,
|
||||
Version
|
||||
}
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
@ -4,11 +4,11 @@ defmodule AccentTest.GraphQL.Resolvers.AccessToken do
|
||||
alias Accent.GraphQL.Resolvers.AccessToken, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
User,
|
||||
AccessToken,
|
||||
Collaborator,
|
||||
AccessToken
|
||||
Project,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
test "show project" do
|
||||
|
@ -4,13 +4,13 @@ defmodule AccentTest.GraphQL.Resolvers.Activity do
|
||||
alias Accent.GraphQL.Resolvers.Activity, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Language,
|
||||
Operation,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
Translation,
|
||||
User,
|
||||
Language,
|
||||
Operation
|
||||
User
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -7,9 +7,9 @@ defmodule AccentTest.GraphQL.Resolvers.Collaborator do
|
||||
alias Accent.GraphQL.Resolvers.Collaborator, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Collaborator,
|
||||
Project,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
|
@ -7,13 +7,13 @@ defmodule AccentTest.GraphQL.Resolvers.Comment do
|
||||
alias Accent.GraphQL.Resolvers.Comment, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Comment,
|
||||
Translation,
|
||||
Language,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
User,
|
||||
Language
|
||||
Translation,
|
||||
User
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -4,13 +4,13 @@ defmodule AccentTest.GraphQL.Resolvers.Document do
|
||||
alias Accent.GraphQL.Resolvers.Document, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Document,
|
||||
Translation,
|
||||
Language,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
User,
|
||||
Language
|
||||
Translation,
|
||||
User
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -4,9 +4,9 @@ defmodule AccentTest.GraphQL.Resolvers.Integration do
|
||||
alias Accent.GraphQL.Resolvers.Integration, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Integration,
|
||||
Project,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@ defmodule AccentTest.GraphQL.Resolvers.Permission do
|
||||
alias Accent.GraphQL.Resolvers.Permission, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,11 @@ defmodule AccentTest.GraphQL.Resolvers.Project do
|
||||
alias Accent.GraphQL.Resolvers.Project, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
ProjectCreator,
|
||||
Language,
|
||||
Project,
|
||||
User,
|
||||
Language
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -4,12 +4,12 @@ defmodule AccentTest.GraphQL.Resolvers.Revision do
|
||||
alias Accent.GraphQL.Resolvers.Revision, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Language,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
Translation,
|
||||
User,
|
||||
Language
|
||||
User
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -7,13 +7,13 @@ defmodule AccentTest.GraphQL.Resolvers.TranslationCommentSubscription do
|
||||
alias Accent.GraphQL.Resolvers.TranslationCommentSubscription, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Language,
|
||||
Project,
|
||||
TranslationCommentsSubscription,
|
||||
Translation,
|
||||
Repo,
|
||||
Revision,
|
||||
User,
|
||||
Language
|
||||
Translation,
|
||||
TranslationCommentsSubscription,
|
||||
User
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -4,14 +4,14 @@ defmodule AccentTest.GraphQL.Resolvers.Translation do
|
||||
alias Accent.GraphQL.Resolvers.Translation, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Translation,
|
||||
Revision,
|
||||
Document,
|
||||
Version,
|
||||
Language,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
Translation,
|
||||
User,
|
||||
Language
|
||||
Version
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -4,8 +4,8 @@ defmodule AccentTest.GraphQL.Resolvers.Version do
|
||||
alias Accent.GraphQL.Resolvers.Version, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
Repo,
|
||||
User,
|
||||
Version
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ defmodule AccentTest.GraphQL.Resolvers.Viewer do
|
||||
alias Accent.GraphQL.Resolvers.Viewer, as: Resolver
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Language,
|
||||
ProjectCreator,
|
||||
User,
|
||||
Language
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
defmodule PlugConn do
|
||||
|
@ -16,18 +16,18 @@ defmodule AccentTest.Hook.Consumers.Email do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Collaborator,
|
||||
Comment,
|
||||
CreateCommentEmail,
|
||||
Hook.Consumers.Email,
|
||||
Language,
|
||||
Project,
|
||||
Revision,
|
||||
User,
|
||||
Translation,
|
||||
Comment,
|
||||
Collaborator,
|
||||
TranslationCommentsSubscription,
|
||||
CreateCommentEmail,
|
||||
ProjectInviteEmail,
|
||||
Hook.Consumers.Email
|
||||
Repo,
|
||||
Revision,
|
||||
Translation,
|
||||
TranslationCommentsSubscription,
|
||||
User
|
||||
}
|
||||
|
||||
setup do
|
||||
|
@ -8,11 +8,11 @@ defmodule AccentTest.Hook.Consumers.Slack do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Project,
|
||||
User,
|
||||
Hook.Consumers.Slack,
|
||||
Integration,
|
||||
Hook.Consumers.Slack
|
||||
Project,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
setup do
|
||||
|
@ -8,15 +8,15 @@ defmodule AccentTest.Hook.Consumers.Websocket do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Collaborator,
|
||||
Comment,
|
||||
Hook.Consumers.Websocket,
|
||||
Language,
|
||||
Project,
|
||||
Repo,
|
||||
Revision,
|
||||
User,
|
||||
Translation,
|
||||
Comment,
|
||||
Collaborator,
|
||||
Hook.Consumers.Websocket
|
||||
User
|
||||
}
|
||||
|
||||
setup do
|
||||
|
@ -3,8 +3,8 @@ defmodule LangueTest.Formatter.Android.Exception do
|
||||
|
||||
Code.require_file("expectation_test.exs", __DIR__)
|
||||
|
||||
alias LangueTest.Formatter.Android.Expectation.{UnsupportedTag, RuntimeError}
|
||||
alias Langue.Formatter.Android
|
||||
alias LangueTest.Formatter.Android.Expectation.{RuntimeError, UnsupportedTag}
|
||||
|
||||
test "android XML unsupported tag" do
|
||||
{expected_parse, result_parse} = Accent.FormatterTestHelper.test_parse(UnsupportedTag, Android)
|
||||
|
@ -7,9 +7,9 @@ defmodule LangueTest.Formatter.Gettext.Header do
|
||||
alias Langue.Formatter.Gettext
|
||||
|
||||
alias LangueTest.Formatter.Gettext.Expectation.{
|
||||
Simple,
|
||||
LanguageHeader,
|
||||
PluralFormsHeader
|
||||
PluralFormsHeader,
|
||||
Simple
|
||||
}
|
||||
|
||||
test "language in header" do
|
||||
|
@ -3,9 +3,9 @@ defmodule LangueTest.Formatter.SimpleJson do
|
||||
|
||||
Code.require_file("expectation_test.exs", __DIR__)
|
||||
|
||||
alias LangueTest.Formatter.SimpleJson.Expectation.{SimpleParse, SimpleSerialize}
|
||||
alias Langue.Formatter.SimpleJson
|
||||
alias Accent.FormatterTestHelper
|
||||
alias Langue.Formatter.SimpleJson
|
||||
alias LangueTest.Formatter.SimpleJson.Expectation.{SimpleParse, SimpleSerialize}
|
||||
|
||||
@tests [
|
||||
Empty
|
||||
|
@ -1,18 +1,18 @@
|
||||
defmodule AccentTest.Movement.Builders.NewSlave do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Movement.Builders.NewSlave, as: NewSlaveBuilder
|
||||
alias Accent.ProjectCreator
|
||||
|
||||
alias Accent.{
|
||||
Document,
|
||||
Language,
|
||||
PreviousTranslation,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
Translation,
|
||||
PreviousTranslation,
|
||||
User,
|
||||
Language,
|
||||
Document
|
||||
User
|
||||
}
|
||||
|
||||
alias Movement.Builders.NewSlave, as: NewSlaveBuilder
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
||||
setup do
|
||||
|
@ -1,18 +1,18 @@
|
||||
defmodule AccentTest.Movement.Builders.NewVersion do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Movement.Builders.NewVersion, as: NewVersionBuilder
|
||||
alias Accent.ProjectCreator
|
||||
|
||||
alias Accent.{
|
||||
Document,
|
||||
Language,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
Translation,
|
||||
User,
|
||||
Language,
|
||||
Version,
|
||||
Document
|
||||
Version
|
||||
}
|
||||
|
||||
alias Movement.Builders.NewVersion, as: NewVersionBuilder
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
||||
setup do
|
||||
|
@ -1,16 +1,16 @@
|
||||
defmodule AccentTest.Movement.Builders.RevisionCorrectAll do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Movement.Builders.RevisionCorrectAll, as: RevisionCorrectAllBuilder
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Language,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
Translation,
|
||||
User,
|
||||
Language
|
||||
User
|
||||
}
|
||||
|
||||
alias Movement.Builders.RevisionCorrectAll, as: RevisionCorrectAllBuilder
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
||||
setup do
|
||||
|
@ -4,11 +4,11 @@ defmodule AccentTest.Movement.Builders.RevisionUncorrectAll do
|
||||
alias Movement.Builders.RevisionUncorrectAll, as: RevisionUncorrectAllBuilder
|
||||
|
||||
alias Accent.{
|
||||
Language,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
Translation,
|
||||
User,
|
||||
Language
|
||||
User
|
||||
}
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
@ -4,14 +4,14 @@ defmodule AccentTest.Movement.Builders.Rollback do
|
||||
alias Movement.Builders.Rollback, as: RollbackBuilder
|
||||
|
||||
alias Accent.{
|
||||
Document,
|
||||
Language,
|
||||
Operation,
|
||||
PreviousTranslation,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
Translation,
|
||||
PreviousTranslation,
|
||||
Operation,
|
||||
User,
|
||||
Language,
|
||||
ProjectCreator,
|
||||
Document
|
||||
User
|
||||
}
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
@ -4,13 +4,13 @@ defmodule AccentTest.Movement.Builders.SlaveConflictSync do
|
||||
alias Movement.Builders.SlaveConflictSync, as: SlaveConflictSyncBuilder
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
ProjectCreator,
|
||||
Translation,
|
||||
User,
|
||||
Document,
|
||||
Language,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
Revision,
|
||||
Document
|
||||
Translation,
|
||||
User
|
||||
}
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
@ -3,12 +3,8 @@ defmodule AccentTest.Movement.Builders.TranslationCorrectConflict do
|
||||
|
||||
alias Movement.Builders.TranslationCorrectConflict, as: TranslationCorrectConflictBuilder
|
||||
|
||||
alias Accent.{
|
||||
Translation
|
||||
}
|
||||
|
||||
test "builder" do
|
||||
translation = %Translation{
|
||||
translation = %Accent.Translation{
|
||||
key: "a",
|
||||
proposed_text: "A"
|
||||
}
|
||||
|
@ -3,12 +3,8 @@ defmodule AccentTest.Movement.Builders.TranslationUncorrectConflict do
|
||||
|
||||
alias Movement.Builders.TranslationUncorrectConflict, as: TranslationUncorrectConflictBuilder
|
||||
|
||||
alias Accent.{
|
||||
Translation
|
||||
}
|
||||
|
||||
test "builder" do
|
||||
translation = %Translation{
|
||||
translation = %Accent.Translation{
|
||||
key: "a",
|
||||
proposed_text: "A"
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
defmodule AccentTest.Migrator.Down do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Movement.Migrator
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Translation,
|
||||
Operation,
|
||||
PreviousTranslation,
|
||||
Operation
|
||||
Repo,
|
||||
Translation
|
||||
}
|
||||
|
||||
alias Movement.Migrator
|
||||
|
||||
test ":noop" do
|
||||
assert {:ok, :noop} == Migrator.down(%{action: "noop"})
|
||||
end
|
||||
|
@ -3,16 +3,16 @@ defmodule AccentTest.Movement.Persisters.Base do
|
||||
|
||||
import Ecto.Query
|
||||
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Translation,
|
||||
Operation,
|
||||
PreviousTranslation,
|
||||
Repo,
|
||||
Revision,
|
||||
Operation
|
||||
Translation
|
||||
}
|
||||
|
||||
alias Movement.Persisters.Base, as: BasePersister
|
||||
|
||||
test "don’t overwrite revision" do
|
||||
revision = %Revision{} |> Repo.insert!()
|
||||
revision_two = %Revision{} |> Repo.insert!()
|
||||
|
@ -1,17 +1,15 @@
|
||||
defmodule AccentTest.Movement.Persisters.NewSlave do
|
||||
use Accent.RepoCase
|
||||
|
||||
require Ecto.Query
|
||||
alias Accent.{
|
||||
Language,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
alias Movement.Persisters.NewSlave, as: NewSlavePersister
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
ProjectCreator,
|
||||
User,
|
||||
Language
|
||||
}
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
|
||||
setup do
|
||||
|
@ -4,12 +4,12 @@ defmodule AccentTest.Movement.Migrator.Up do
|
||||
alias Movement.Migrator
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
Translation,
|
||||
User,
|
||||
Revision,
|
||||
Operation,
|
||||
PreviousTranslation,
|
||||
Operation
|
||||
Repo,
|
||||
Revision,
|
||||
Translation,
|
||||
User
|
||||
}
|
||||
|
||||
test ":noop" do
|
||||
|
@ -2,10 +2,12 @@ defmodule AccentTest.Plugs.AssignCurrentUser do
|
||||
use Accent.RepoCase
|
||||
use Plug.Test
|
||||
|
||||
alias Accent.Repo
|
||||
alias Accent.User
|
||||
alias Accent.AccessToken
|
||||
alias Accent.Plugs.AssignCurrentUser
|
||||
alias Accent.{
|
||||
AccessToken,
|
||||
Plugs.AssignCurrentUser,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
@user %User{email: "test@test.com"}
|
||||
@token %AccessToken{revoked_at: nil, token: "1234"}
|
||||
|
@ -2,8 +2,8 @@ defmodule AccentTest.Plugs.BotParamsInjector do
|
||||
use ExUnit.Case, async: true
|
||||
use Plug.Test
|
||||
|
||||
alias Accent.User
|
||||
alias Accent.Plugs.BotParamsInjector
|
||||
alias Accent.User
|
||||
|
||||
defp call_plug(user, query_params \\ %{}) do
|
||||
:get
|
||||
|
@ -3,7 +3,6 @@ defmodule AccentTest.Plugs.EnsureUnlockedFileOperations do
|
||||
use Plug.Test
|
||||
|
||||
alias Accent.Plugs.EnsureUnlockedFileOperations
|
||||
|
||||
alias Accent.Project
|
||||
|
||||
test "no halt conn" do
|
||||
|
@ -1,14 +1,14 @@
|
||||
defmodule AccentTest.Plugs.MovementContextParser do
|
||||
use Accent.RepoCase
|
||||
use Plug.Test
|
||||
alias Accent.Plugs.MovementContextParser
|
||||
|
||||
alias Accent.{
|
||||
Repo,
|
||||
ProjectCreator,
|
||||
Document,
|
||||
Language,
|
||||
User,
|
||||
Document
|
||||
Plugs.MovementContextParser,
|
||||
ProjectCreator,
|
||||
Repo,
|
||||
User
|
||||
}
|
||||
|
||||
def file(filename \\ "simple.json") do
|
||||
|
@ -1,5 +1,4 @@
|
||||
defmodule AccentTest.PreviousTranslation do
|
||||
use ExUnit.Case
|
||||
|
||||
use ExUnit.Case, async: true
|
||||
doctest Accent.PreviousTranslation
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule AccentTest.CollaboratorCreator do
|
||||
use Accent.RepoCase
|
||||
|
||||
alias Accent.{Repo, User, Project, CollaboratorCreator}
|
||||
alias Accent.{CollaboratorCreator, Project, Repo, User}
|
||||
|
||||
test "create unknown email" do
|
||||
email = "test@test.com"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user