Skip to content

Commit 17f44d1

Browse files
committed
adding steps
1 parent 3ebaf6a commit 17f44d1

File tree

4 files changed

+54
-8
lines changed

4 files changed

+54
-8
lines changed

prompts/pylint/2-make-db-schema.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,31 @@ tools:
1616
command:
1717
- "{{database}}"
1818
- "{{sql}}"
19+
- name: delete_folder
20+
description: Runs rm -rf on a folder
21+
parameters:
22+
type: object
23+
properties:
24+
path:
25+
type: string
26+
description: Path of the folder to delete
27+
container:
28+
image: vonwig/bash_alpine
29+
command:
30+
- "rm -rf {{path|safe}}"
1931
---
2032

2133
# prompt user
34+
35+
delete the /thread/db.sqlite
2236

2337
Write a SQL schema for a table named RANGES with columns ID, PATH, START_LINE, END_LINE, START_COLUMN, and
24-
END_COLUMN. The ID is the primary key and is a STRING type.
38+
END_COLUMN. The ID is the primary key and auto increments.
39+
40+
Write a SQL schema for a table named VIOLATIONS with a foreign key named RANGE of type ID, STRING, and columns
41+
MESSAGE, TYPE, VIOLATION_ID. The ID is the primary key, and auto increments.
2542

26-
Write a SQL schema for a table named VIOLATIONS with a foreign key named RANGE of type STRING, and columns
27-
MESSAGE, TYPE, and ID. The ID is the primary key and should be sequenced.
43+
allow END_LINE and END_COLUMN to be nullable.
2844

29-
Run the sqlite command with the database set to `/thread/db.dqlite` and send the SQL generated above.
45+
Run the sqlite command with the database set to `/thread/db.sqlite` and send the SQL generated above.
3046

prompts/pylint/3-4-json-violations->sql-violations.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ It should then iterate over each element of an array with the following schema:
2424
{"message": "some violation", "path": "app.py", "type": "error",
2525
"line": 0, "column": 0, "endLine": 1, "endColumn": 1, "path": "src/app.py"}
2626
]
27+
2728
```
2829

2930
For each element of the array, it should create two INSERT statements.
30-
The first should insert the columns ID, PATH, START_LINE, END_LINE, START_COLUMN, END_COLUMN
31-
into a tabled named RANGES using the properties from the map. The ID column should be a random string.
32-
The second should insert the columns MESSAGE, TYPE, RANGE into a table named VIOLATIONS
31+
The first should insert the columns PATH, START_LINE, END_LINE, START_COLUMN, END_COLUMN
32+
into a tabled named RANGES using the properties from the map.
33+
The second should insert the columns MESSAGE, TYPE, RANGE, VIOLATION_ID into a table named VIOLATIONS
3334
using the properties from the map. The RANGE column should be the ID of the previous row in the RANGES table.
3435
If any strings contain single quotes, they should be escaped.
3536

37+
Line and column represent START_LINE and START_COLUMN
38+
3639
The statements should be written to the file /thread/insert.sql
3740

3841
Now execute the javascript code.

prompts/pylint/4.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
tools:
3+
- name: sqlite
4+
description: execute SQLite commands
5+
parameters:
6+
type: object
7+
properties:
8+
database:
9+
type: string
10+
description: The path to the SQLite database
11+
sql:
12+
type: string
13+
description: The SQL command to run
14+
container:
15+
image: vonwig/sqlite:latest
16+
command:
17+
- "{{database}}"
18+
- "{{sql|safe}}"
19+
---
20+
21+
# prompt user
22+
23+
1. Run `.read /thread/insert.sql` against the database `/thread/db.sqlite`.
24+
25+
2. After executing the SQL, count the number of rows in the `VIOLATIONS` and `RANGES` tables:
26+
- `SELECT count(*) FROM VIOLATIONS;`
27+
- `SELECT count(*) FROM RANGES;`

prompts/pylint/6-1-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ CREATE TABLE VIOLATIONS (ID INTEGER PRIMARY KEY AUTOINCREMENT, MESSAGE TEXT, TYP
2727
CREATE TABLE RANGES (ID STRING PRIMARY KEY, PATH TEXT, START_LINE INT, END_LINE INT, START_COLUMN INT, END_COLUMN INT);
2828
```
2929

30-
Generate a query to find all the violations in the file `src/app.py` and then run the sqlite command on database `/thread/db.dqlite`.
30+
Generate a query to list each the violations by just the violation name `black_listed_name.py` in a readble format, and then run the sqlite command on database `/thread/db.sqlite`.

0 commit comments

Comments
 (0)