Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue175 #176

Merged
merged 6 commits into from Feb 11, 2019
Merged

Issue175 #176

merged 6 commits into from Feb 11, 2019

Conversation

kbaird
Copy link
Contributor

@kbaird kbaird commented Feb 8, 2019

Makes FormatRequired plug accept a legal multi-RIO payload.

lib/jsonapi.ex Outdated Show resolved Hide resolved
lib/jsonapi/serializer.ex Outdated Show resolved Hide resolved
@@ -5,12 +5,20 @@ defmodule JSONAPI.FormatRequired do

import JSONAPI.ErrorView

# Cf. https://jsonapi.org/format/#crud-updating-to-many-relationships
@update_has_many_relationships_methods ~w[DELETE PATCH POST]
Copy link
Contributor Author

@kbaird kbaird Feb 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, DELETE is handled earlier by the first clause. But it is one of the allowed methods for the multi-RIO payload, so I thought including it here made more sense than omitting it.

@jherdman
Copy link
Contributor

jherdman commented Feb 9, 2019

The Credo changes are a bit surprising. On my dev machine, and CI, mix credo reports no concerns. Would you mind discussing your set up? Perhaps it'll help us figure out the discrepancies.

@kbaird
Copy link
Contributor Author

kbaird commented Feb 9, 2019

Sure. Here's what I get in master.

$ iex -v
Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

IEx 1.8.1 (compiled with Erlang/OTP 20)
$ mix credo --strict
Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByAssignment
Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByCase
Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByDef
Ignoring an undefined check: Credo.Check.Warning.NameRedeclarationByFn
Checking 17 source files ...

info: the following checks were skipped because they're not compatible with
your version of Elixir (1.8.1).

   1) Credo.Check.Refactor.MapInto


  Code Readability                                                              
┃ 
┃ [R] ↘ The alias `JSONAPI.Config` is not alphabetically ordered among its 
┃       group.
┃       lib/jsonapi/serializer.ex:9:9 #(JSONAPI.Serializer)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/jsonapi.ex:33 #(JSONAPI.mime_type)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/jsonapi.ex:12 #(JSONAPI.json_library)

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 0.4 seconds (0.01s to load, 0.4s running checks)
168 mods/funs, found 3 code readability issues.

@jherdman
Copy link
Contributor

jherdman commented Feb 9, 2019

OH! Gotcha. OK, AFAIK we're not using the --strict flag. Would you mind reverting the Credo changes for now? If we want to move to strict that may be a worthy PR in-and-of-itself.

@kbaird
Copy link
Contributor Author

kbaird commented Feb 9, 2019

Credo changes now in #177

@jherdman
Copy link
Contributor

@kbaird could you rebase this against master? It has your Credo changes, and I want to make sure the build is still green (I'm sure it is, but ya know... safe vs. sorry).

Copy link
Contributor

@jherdman jherdman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I'd love to see a rebase before merging. I'd feel better about the CI results.

@kbaird
Copy link
Contributor Author

kbaird commented Feb 10, 2019

Rebased via the procedure at https://gist.github.com/ravibhure/a7e0918ff4937c9ea1c456698dcd58aa

@doomspork
Copy link
Member

@kbaird something isn't quite right but I think it's c1b1849 that's the culprit, it adds () to the functions and fails Credo.

There's 2 ways we can fix this:

$ git fetch --all --prune
$ git rebase upstream/master -i --autostash --autosquash
# I do interactive rebase so I can squash, fixup, and rename commits.
# At the screen that pops up, delete the c1b1849 line, save and exit.
# That should remove that commit for us.
$ git push origin master -f

You could add a new commit that undoes those changes, when we squash it won't matter 😁

I'd be happy to help you if that doesn't resolve the issues. I'd expect the credo --strict call to pass on your branch.

@kbaird
Copy link
Contributor Author

kbaird commented Feb 11, 2019

@doomspork I just backed it up one commit. Let me know if it needs any more attention from me. Thanks.

@jherdman
Copy link
Contributor

@doomspork you good with this? I think we're all set to merge.

Copy link
Contributor

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 ⚡️

@doomspork doomspork merged commit b467f43 into beam-community:master Feb 11, 2019
@doomspork
Copy link
Member

Thanks so much @kbaird and @jherdman 😁

@kbaird kbaird deleted the Issue175 branch February 12, 2019 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants