Skip to content

Commit

Permalink
feature: Tracetest Linter 馃悪 (#2547)
Browse files Browse the repository at this point in the history
* feature: The Dream 馃挏

* feature(openapi): adding specs for linterns

* updating types for lintern

* updating types for lintern

* adding lintern resource logic

* feature(cli): fixing UI type

* add runner structure

* add rule to check if there are missing required attributes

* add test to required attributes rule

* registering lintern resource on app

* registering lintern resource on app

* feat(frontend): add linter settings page

* adding lintern runner logic

* registering lintern resource on app

* feat(frontend): add LintResult component in test run page

* first working version

* fix(frontend): fix rule results

* add not empty attribute rule

* feat(frontend): add LinterResults component styles

* add rule to validate attribute names

* remove anonymous variables

* rename files

* add kind to span and add span naming rule

* registering rules

* finishing required attrs rule

* feat(frontend): add dag lint icon and result click

* feat(frontend): add linter loading component

* adding common and security plugins

* feat(frontend): add dag lint errors component

* UI cleanup

* UI cleanup

* fix(frontend): fix styles and linter settings

* feat(frontend): add octolint footer

* fixing unit tests

* fixing unit tests

* fixing annoying typo

* fixing e2e tests

* cleanup changes

* tracetest linter UX mvp improvements

* tracetest linter UX mvp improvements

* PR comments and beta badge

---------

Co-authored-by: Matheus Nogueira <matheus.nogueira2008@gmail.com>
Co-authored-by: Jorge Padilla <jorge.esteban.padilla@gmail.com>
  • Loading branch information
3 people committed May 31, 2023
1 parent 94266f6 commit a5de528
Show file tree
Hide file tree
Showing 104 changed files with 6,252 additions and 70 deletions.
102 changes: 102 additions & 0 deletions api/linters.yaml
@@ -0,0 +1,102 @@
openapi: 3.0.0
components:
schemas:
LinterResourceList:
type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/LinterResource"
LinterResource:
type: object
properties:
type:
type: string
enum:
- Linter
spec:
type: object
properties:
id:
type: string
name:
type: string
enabled:
type: boolean
minimumScore:
type: integer
plugins:
type: array
items:
$ref: "#/components/schemas/LinterResourcePlugin"
LinterResourcePlugin:
type: object
properties:
name:
type: string
enabled:
type: boolean
required:
type: boolean
LinterResult:
type: object
properties:
passed:
type: boolean
score:
type: integer
plugins:
type: array
items:
$ref: "#/components/schemas/LinterResultPlugin"
LinterResultPlugin:
type: object
properties:
name:
type: string
description:
type: string
passed:
type: boolean
score:
type: integer
rules:
type: array
items:
$ref: "#/components/schemas/LinterResultPluginRule"
LinterResultPluginRule:
type: object
properties:
name:
type: string
description:
type: string
passed:
type: boolean
weight:
type: integer
tips:
type: array
items:
type: string
results:
type: array
items:
$ref: "#/components/schemas/LinterResultPluginRuleResult"
LinterResultPluginRuleResult:
type: object
properties:
spanId:
type: string
errors:
type: array
items:
type: string
passed:
type: boolean
severity:
type: string
enum:
- error
- warning
127 changes: 127 additions & 0 deletions api/openapi.yaml
Expand Up @@ -1265,3 +1265,130 @@ paths:
$ref: "./version.yaml#/components/schemas/Version"
500:
description: "problem getting the version of the API"

# Linters
/linters:
get:
tags:
- resource-api
summary: "List Linters"
description: "List Linters available in Tracetest."
operationId: listLinters
parameters:
- $ref: "./parameters.yaml#/components/parameters/take"
- $ref: "./parameters.yaml#/components/parameters/skip"
- $ref: "./parameters.yaml#/components/parameters/switchableResourceSortBy"
- $ref: "./parameters.yaml#/components/parameters/sortDirection"
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResourceList"
text/yaml:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResourceList"
400:
description: "invalid query for Linters, some data was sent in incorrect format."
500:
description: "problem listing Linters"
post:
tags:
- resource-api
summary: "Create an Linter"
description: "Create an Linter that can be used by tests and Linters"
operationId: createLinter
requestBody:
content:
application/json:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
text/yaml:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
responses:
201:
description: successful operation
content:
application/json:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
text/yaml:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
500:
description: "problem creating an Linter"

/linters/{LinterId}:
get:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/LinterId"
summary: "Get a specific Linter"
description: "Get one Linter by its id"
operationId: getLinter
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
text/yaml:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
404:
description: "Linter not found"
500:
description: "problem getting a Linter"
put:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/LinterId"
summary: "Update a Linter"
description: "Update a Linter used on Tracetest"
operationId: updateLinter
requestBody:
content:
application/json:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
text/yaml:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
text/yaml:
schema:
$ref: "./linters.yaml#/components/schemas/LinterResource"
400:
description: "invalid Linter, some data was sent in incorrect format."
404:
description: "Linter not found"
500:
description: "problem updating an Linter"
delete:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/LinterId"
summary: "Delete an Linter"
description: "Delete an Linter from Tracetest"
operationId: deleteLinter
responses:
204:
description: successful operation
400:
description: "invalid Linter, some data was sent in incorrect format."
404:
description: "Linter not found"
500:
description: "problem deleting an Linter"
8 changes: 8 additions & 0 deletions api/parameters.yaml
Expand Up @@ -133,3 +133,11 @@ components:
description: "ID of an environment used on Tracetest to inject values into tests and transactions"
schema:
type: string

LinterId:
in: path
name: LinterId
required: true
description: "ID of an Linter"
schema:
type: string
4 changes: 4 additions & 0 deletions api/tests.yaml
Expand Up @@ -136,6 +136,8 @@ components:
EXECUTING,
AWAITING_TRACE,
AWAITING_TEST_RESULTS,
ANALYZING_TRACE,
ANALYZING_ERROR,
FINISHED,
STOPPED,
TRIGGER_FAILED,
Expand Down Expand Up @@ -175,6 +177,8 @@ components:
$ref: "./trace.yaml#/components/schemas/Trace"
result:
$ref: "#/components/schemas/AssertionResults"
linter:
$ref: "linters.yaml#/components/schemas/LinterResult"
outputs:
type: array
items:
Expand Down
2 changes: 2 additions & 0 deletions api/trace.yaml
Expand Up @@ -23,6 +23,8 @@ components:
type: string
name:
type: string
kind:
type: string
startTime:
type: integer
format: int64
Expand Down

0 comments on commit a5de528

Please sign in to comment.