Skip to content

Commit d2e60e0

Browse files
authored
Merge pull request #1214 from PokeAPI/csv-lint
Lint csvs
2 parents 7d62449 + 523e00e commit d2e60e0

File tree

3 files changed

+607711
-607681
lines changed

3 files changed

+607711
-607681
lines changed

.github/workflows/database.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ on:
44
pull_request:
55

66
jobs:
7+
csv:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
- name: Lint
13+
run: |
14+
set -e
15+
curl -sSL https://github.com/Clever/csvlint/releases/download/v0.3.0/csvlint-v0.3.0-linux-amd64.tar.gz | tar xz --strip-components=1
16+
for filename in data/v2/csv/*.csv; do
17+
echo "$filename"
18+
./csvlint -lazyquotes "$filename" # TODO: remove lazyquotes when https://github.com/Clever/csvlint/issues/45 will be addressed
19+
done
720
sqlite:
821
runs-on: ubuntu-latest
922
steps:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Check if a csv has all required commas
2+
3+
var fs = require("fs");
4+
5+
var allLines = fs.readFileSync('./data/v2/csv/pokemon_moves.csv').toString().split('\n');
6+
7+
allLines.forEach(function (line) {
8+
var count = (line.match(/,/g) || []).length;
9+
if (count === 5) {
10+
line = line + ","
11+
}else if ( count === 6) {
12+
console.log('found mastery')
13+
} else if (count < 5) {
14+
console.log('?')
15+
}
16+
fs.appendFileSync("./data/v2/csv/pokemon_moves1.csv", line.toString() + "\n");
17+
});

0 commit comments

Comments
 (0)