Commit Graph

17 Commits

Author SHA1 Message Date
Steve Coffman 5e3c4d1be8 Add CODEOWNERS so community PR reviews are auto-assigned (#135)
Signed-off-by: Steve Coffman <steve@khanacademy.org>
2021-10-04 14:24:15 -04:00
Ben Kraft 59303a4710 [🔥AUDIT🔥] Remove security issue template (#114)
🖍 _This is an audit!_ 🖍

## Summary:
I figured we should have this to say "STOP! Use HackerOne instead".
But GitHub anticipated that and already links to the security policy
(`docs/SECURITY.md`) as an option when [creating an issue][1], so
it's just duplicative.  In this commit I remove it.

[1]: https://github.com/Khan/genqlient/issues/new/choose

## Test plan:
above link should show just one option for security


Author: benjaminjkraft

Auditors: StevenACoffman

Required Reviewers: 

Approved By: 

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/114
2021-09-24 17:51:45 -07:00
Ben Kraft 1d6e728181 Add open-source boilerplate (#96)
## Summary:
There's a lot these days!  I got most of it from the GitHub docs [1], as
well as looking at other projects.  I'll probably hold off on landing
this until a couple more things land, then land this and tag v0.1.0.

[1] https://docs.github.com/en/communities

Issue: https://github.com/Khan/genqlient/issues/35

## Test plan: view in github UI


Author: benjaminjkraft

Reviewers: jvoll, StevenACoffman, aberkan, dnerdy, mahtabsabet, MiguelCastillo

Required Reviewers: 

Approved By: jvoll, StevenACoffman

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/96
2021-09-16 12:05:16 -07:00
Ben Kraft e88305ecbd Add support for abstract-typed named fragments (#79)
## Summary:
In previous commits I added support to genqlient for interfaces,
inline fragments, and, most recently, named fragments of concrete
(object) type.  This leaves only named fragments of interface type!
Like other named fragments, these are useful for code-sharing,
especially if you want some code that can handle the same fields of
several different types.

As seems to be inevitable with genqlient, this was mostly pretty
straightforward, although there turned out to be surprisingly many
places we needed to add some handling; almost anywhere that touches
interfaces *or* named fragments needed some updates.  But it's all
hopefully fairly clear code.

As a part of this change I made three semi-related improvements:
1. I refactored the handling of descriptions (i.e. GoDoc), because it
   was getting more and more confusing and duplicative.  I'm still not
   sure how much of it it makes sense to inline vs. separate, but I
   think this is better than it was.  This resulted in some minor
   changes to descriptions, generally in the direction of making things
   more consistent.
2. I bumped the minimum Go version to 1.14 so we can guarantee support
   for duplicate interface methods.  These are useful for
   abstract-in-absstract spreads; we generate an interface for the
   fragment, and (if the fragment-type implements the scope-type) we
   embed it into the interface we generate for its spread-context, and
   if the two have a duplicated field we thus duplicate the method.  It
   wouldn't be impossible to support this on 1.13 (maybe just by
   omitting said embed) but it didn't seem worth it.  This also removes
   a few special-cases in tests.
3. I added a bunch of code to better format syntax errors in the
   generated code (which we see from `gofmt`).  This is mostly just an
   internal improvement; I wrote it because I got annoyed while hunting
   down a few such errors..

Fixes, at last, #8.

Issue: https://github.com/Khan/genqlient/issues/8

## Test plan:
make check


Author: benjaminjkraft

Reviewers: dnerdy, benjaminjkraft, aberkan, MiguelCastillo

Required Reviewers: 

Approved By: dnerdy

Checks:  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/79
2021-09-09 09:48:18 -07:00
Ben Kraft 1c061b153a Create a separate module for our golangci-lint version (#80)
## Summary:
In principle, it's not a problem to have test-only deps in your go.mod,
because they won't end up in your importers' builds (and in newer Go
versions may not even be downloaded.  (Which is why there's no
annotation to do so.)  In practice, that doesn't really work for
golangci-lint, because it doesn't really use semver (reasonably, in that
any updated linter may break lint in your codebase).  And we don't
really need it other than to run the binary at a particular version.

So now, I put it in its own go module.  This requires a bit more
throat-clearing to run it (we can't just `go run`), but it's not so bad
and avoids anyone getting annoyed at us because we upgraded their
golangci-lint for them.

We could do the same for `internal/integration`, which adds quite a lot,
including gqlgen, to our dependency tree, but it's not clear there's a
need.

Fixes #62.

Issue: https://github.com/Khan/genqlient/issues/62

## Test plan:
make check


Author: benjaminjkraft

Reviewers: dnerdy, StevenACoffman, benjaminjkraft, aberkan, MiguelCastillo

Required Reviewers: 

Approved By: dnerdy, StevenACoffman

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/80
2021-09-09 09:23:00 -07:00
Ben Kraft 700392315a Enable golangci-lint (#49)
## Summary:
It would be nice to have some linting beyond `go vet`!  Now we do.  I
started by copying the config from Khan/webapp.  I did remove a couple
of staticcheck checks that I didn't feel were useful.  (Note also that
exportloopref is the replacement for scopelint in newer golangci-lint.)

Included are all the needed lint fixes; most are stylistic but the
changes in the example are a (minor) bugfix.

Fixes #22.
Issue: https://github.com/Khan/genqlient/issues/22

## Test plan:
make check

Author: benjaminjkraft

Reviewers: aberkan, dnerdy, benjaminjkraft, csilvers, MiguelCastillo

Required Reviewers: 

Approved by: aberkan, dnerdy

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint

Pull request URL: https://github.com/Khan/genqlient/pull/49
2021-08-20 10:39:12 -07:00
Ben Kraft c34c5ff505 Turn on test coverage in Makefile/actions 2021-04-23 18:18:07 -07:00
Ben Kraft 33f4d9642e issue templates 2021-04-06 14:06:38 -07:00
Ben Kraft 77804e3475 naming things 2021-04-02 18:13:10 -07:00
Ben Kraft 9c8cf02181 proper test wiring for example test in github actions 2021-04-02 18:04:05 -07:00
Ben Kraft efc6549d7e fix example args in github actions 2021-04-02 17:18:37 -07:00
Ben Kraft 5ab592ac18 try example in github actions again 2021-04-02 17:17:38 -07:00
Ben Kraft 088ec53ad5 fix branch name in github actions 2021-03-22 18:14:16 -07:00
Ben Kraft a42c9b8166 clean up various TODOs and comments 2021-03-22 18:11:51 -07:00
Ben Kraft 6caa3fc6c4 Give up on running example in GitHub Actions for now 2020-03-27 16:27:08 -07:00
Ben Kraft 654a5c6795 Explicitly pass envvar in github workflow 2020-03-27 16:10:48 -07:00
Ben Kraft 7b03ec7a83 Set up github actions 2020-03-27 16:05:00 -07:00