gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.

gqlanalysis

pkg.go.dev

gqlanalysis defines the interface between a modular static analysis for GraphQL in Go. gqlanalysis is inspired by go/analysis.

gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.

How to use

Analyzer

The primary type in the API is Analyzer. An Analyzer statically describes an analysis function: its name, documentation, flags, relationship to other analyzers, and of course, its logic.

package lackid

var Analyzer = &gqlanalysis.Analyzer{
	Name: "lackid",
	Doc:  "lackid finds a selection for a type which has id field but the selection does not have id",
	Run:  run,
	...
}

func run(pass *gqlanalysis.Pass) (interface{}, error) {
	...
}

Driver

An analysis driver is a program that runs a set of analyses and prints the diagnostics that they report. The driver program must import the list of Analyzers it needs.

A typical driver can be created with multichecker package.

package main

import (
        "github.com/gqlgo/gqlanalysis/multichecker"
        "github.com/gqlgo/lackid"
        "github.com/gqlgo/myanalyzer"
)

func main() {
        multichecker.Main(
		lackid.Analyzer,
		myanalyzer.Analyzer,
	)
}

Pass

A Pass describes a single unit of work: the application of a particular Analyzer to given GraphQL's schema and query files. The Pass provides information to the Analyzer's Run function about schemas and queries being analyzed, and provides operations to the Run function for reporting diagnostics and other information back to the driver.

type Pass struct {
        Analyzer *Analyzer

        Schema   *ast.Schema
        Queries  []*ast.QueryDocument
        Comments []*Comment

        Report   func(*Diagnostic)
        ResultOf map[*Analyzer]interface{}
}

Diagnostic

A Diagnostic is a message associated with a source location. Pass can report a diagnostic via Report field or Reportf method.

type Diagnostic struct {
        Pos     *ast.Position
        Message string
}

Implementations of Analyzer

Author

Appify Technologies, Inc.

Owner
GraphQL go library and tools
null
Similar Resources

A directory of hardware related libs, tools, and tutorials for Go

Go + hardware This repo is a directory of tools, packages and tutorials to let you introduce Go in your hardware projects. Why Go? Go can target platf

Dec 30, 2022

gopkg is a universal utility collection for Go, it complements offerings such as Boost, Better std, Cloud tools.

gopkg is a universal utility collection for Go, it complements offerings such as Boost, Better std, Cloud tools. Table of Contents Introduction

Jan 5, 2023

Little Bug Bounty & Hacking Tools⚔️

Little Bug Bounty & Hacking Tools ⚔️

Jan 7, 2023

common tools for golang

utils common tools for golang package main

Dec 27, 2021

Source code of Liteloader Tools

LiteLoader Tools This repository store the source code of some LiteLoader Tools Prebuilt Binary see /bin folder Image2Binary [Golang] convert Image(jp

Aug 30, 2022

Go tools sourcecode read and customize

Go Tools This subrepository holds the source for various packages and tools that support the Go programming language. Some of the tools, godoc and vet

Oct 24, 2021

A fully Go userland with Linux bootloaders! u-root can create a one-binary root file system (initramfs) containing a busybox-like set of tools written in Go.

u-root Description u-root embodies four different projects. Go versions of many standard Linux tools, such as ls, cp, or shutdown. See cmds/core for m

Dec 29, 2022

Mackerel SLI/SLO tools

shimesaba For SRE to operate and monitor services using Mackerel. Description shimesaba is a tool for tracking SLO/ErrorBudget using Mackerel as an SL

Nov 21, 2022

Like tools/cmd/stringer with bitmask features

Bitmasker Bitmasker is a tool used to automate the creation of helper methods when dealing with bitmask-type constant flags. Given the name of an unsi

Nov 25, 2021
Comments
  • Release for v0.3.5

    Release for v0.3.5

    This pull request is for the next release as v0.3.5 created by tagpr. Merging it will tag v0.3.5 to the merge commit and create a GitHub release.

    You can modify this branch "tagpr-from-v0.3.4" directly before merging if you want to change the next version number or other files for the release.

    How to change the next version as you like

    There are two ways to do it.

    • Version file
      • Edit and commit the version file specified in the .tagpr configuration file to describe the next version
      • If you want to use another version file, edit the configuration file.
    • Labels convention
      • Add labels to this pull request like "tagpr:minor" or "tagpr:major"
      • If no conventional labels are added, the patch version is incremented as is.

    What's Changed

    • Add a tagpr workflow of GitHub Actions by @tenntenn in https://github.com/gqlgo/gqlanalysis/pull/17
    • Fix dependencies handling by @tenntenn in https://github.com/gqlgo/gqlanalysis/pull/16

    Full Changelog: https://github.com/gqlgo/gqlanalysis/compare/v0.3.4...v0.3.5

  • Add CLI argument for introspection-header

    Add CLI argument for introspection-header

    Abstract

    認証を介さないと取得できないGraphQLスキーマが存在している。内部ではintrospection時にHTTP Headerを付与できるコードになっていたのでコマンドラインから引数で受け取れるようにする

    コマンドライン引数の形式は -introspeciton-header=key1:value1,key2:value2。最終的にはhttp.Header(=map[string][]string)として扱うが、introspectionでhttpを配列に渡したいことが思いつかないのでkey:valueは1:1にしてしまっている。理由は1:1じゃない場合のmapを引数で受け取る場合の適切なフォーマットが思い浮かばなかったのが大きな要因。PRに書いてあるような具合ならわかりやすいと思っている

    How

    flag パッケージの Value インタフェースに準拠すればデフォルト以外の型も扱えるのでその方式をとっている。"key1:value1"が引数れあれば実態は map[string][]string{ "key1": []string{"value1"} } になる

This is Go library for building GraphQL client with gqlgen

gqlgenc What is gqlgenc ? This is Go library for building GraphQL client with gqlgen Motivation Now, if you build GraphQL api client for Go, have choi

Jan 7, 2023
The easiest way to make API documents for GraphQL

Document Generator for GraphQL gqldoc is now alpha gqldoc is command line tool to generate documents from GraphQL schema or your GraphQL endpoint. the

Dec 20, 2022
A port of the parser from graphql-js into golang

gqlparser This is a parser for graphql, written to mirror the graphql-js reference implementation as closely while remaining idiomatic and easy to use

Dec 27, 2022
Project developed for the course Software Systems Analysis and Design (SSAD) at IU in F21 semester.

Go knowledge yield summary Project description Project developed for the course Software Systems Analysis and Design (SSAD) at IU in F21 semester. Eva

Sep 17, 2022
Continuous profiling for analysis of CPU, memory usage over time, and down to the line number. Saving infrastructure cost, improving performance, and increasing reliability.
Continuous profiling for analysis of CPU, memory usage over time, and down to the line number. Saving infrastructure cost, improving performance, and increasing reliability.

Continuous profiling for analysis of CPU, memory usage over time, and down to the line number. Saving infrastructure cost, improving performance, and increasing reliability.

Jan 2, 2023
A process that receives probe information and stores it in a database for reporting and analysis

probed is a process that receives probe information and stores it in a database for reporting and analysis.

Nov 2, 2022
Sentiment Analysis Pipeline + API written in Golang (currently processing Twitter tweets).

Go Sentiment Analysis Components Config: config module based in JSON (enter twitter credentials for use) Controllers: handle the API db call/logic for

Mar 22, 2022
Sentiment Analysis Pipeline + API written in Golang (currently processing Twitter tweets).

Go Sentiment Analysis Components Config: config module based in JSON (enter twitter credentials for use) Controllers: handle the API db call/logic for

Mar 22, 2022
A protoc plugin that generates fieldmask paths as static type properties for proto messages

protoc-gen-fieldmask A protoc plugin that generates fieldmask paths as static ty

Nov 3, 2022
Code generation tools for Go.

interfaces Code generation tools for Go's interfaces. Tools available in this repository: cmd/interfacer cmd/structer cmd/interfacer Generates an inte

Dec 23, 2022