-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlint.sh
More file actions
55 lines (44 loc) · 1.84 KB
/
lint.sh
File metadata and controls
55 lines (44 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
print_section() {
echo "--------------------------------------------------------------------"
echo "Linting $1 code ($2)..."
echo "--------------------------------------------------------------------"
}
# Note: For R, I have used ```{r} #| file: file.R``` instead of
# ```{r}{{< include file.R >}}```, as the latter breaks lintr (false positive
# messages, and missing other messages) and breaks. It doesn't break
# if used in non-active code chunks as linters ignore those.
print_section "R" "index.qmd"
Rscript -e 'lintr::lint("index.qmd")'
print_section "R" "pages/"
Rscript -e 'lintr::lint_dir("pages")'
print_section "R" "tests/"
Rscript -e 'lintr::lint_dir("tests")'
echo "--------------------------------------------------------------------"
print_section "python" "index.qmd and pages/"
lintquarto -l pylint flake8 -p index.qmd pages/
print_section "python" "pages/ and tests/"
echo "============================================================="
echo "Running pylint..."
echo "============================================================="
IGNORE_LIST=(
linting_resources
outputs_resources
replications_resources
parallel_resources
tests_resources
)
RESOURCE_PATHS=(
pages/guide/output_analysis/outputs_resources
pages/guide/output_analysis/replications_resources
pages/guide/output_analysis/parallel_resources
pages/guide/verification_validation/tests_resources
)
# Lint all, skipping ignores
pylint pages tests --ignore=$(IFS=,; echo "${IGNORE_LIST[*]}")
# Lint resource-specific paths with disables
pylint "${RESOURCE_PATHS[@]}" --disable=missing-module-docstring,undefined-variable
echo "============================================================="
echo "Running flake8..."
echo "============================================================="
flake8 pages tests --exclude linting_resources,replications_resources