Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab_templates
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
gitlab_templates
Merge requests
!333
#3508450
Improvments to run-local-checks
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
#3508450
Improvments to run-local-checks
issue/gitlab_templates-3508450:3508450-run-local-checks
into
main
Overview
0
Commits
3
Pipelines
2
Changes
2
Merged
Jonathan Smith
requested to merge
issue/gitlab_templates-3508450:3508450-run-local-checks
into
main
1 month ago
Overview
0
Commits
3
Pipelines
2
Changes
2
Expand
Closes
#3508450
0
0
Merge request reports
Compare
main
version 1
c2ffecc2
1 month ago
main (base)
and
latest version
latest version
c2ffecc2
3 commits,
1 month ago
version 1
c2ffecc2
3 commits,
1 month ago
2 files
+
24
−
18
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
scripts/run-local-checks.sh
+
9
−
5
Options
#!/bin/bash
# Launch from the root of this project: "./scripts/run-local-checks.sh [fix] [clean]".
# Launch from the root of this project: "./scripts/run-local-checks.sh [fix]
[debug]
[clean]".
#
# Optional arguments:
# fix - to run the fixer options of eslint and phpcs.
# debug - to show verbose output.
# clean - to remove the installed software and files copied from assets.
#
# Helper script to run all the checks that will be run via GitLab CI.
@@ -25,13 +26,16 @@ php scripts/prepare-cspell.php
npm
install
composer
install
EXIT_CODE
=
0
npx cspell
--show-suggestions
--show-context
--no-progress
--dot
{
**
,.
**
}
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
NO_PROGRESS
=
$(
[[
"
$1
"
==
"debug"
]]
&&
echo
""
||
echo
"--no-progress"
)
;
npx cspell
--show-suggestions
--show-context
--dot
$NO_PROGRESS
{
**
,.
**
}
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
ESLINT_FIX
=
$(
[[
"
$1
"
==
"fix"
]]
&&
echo
"--fix"
||
echo
""
)
;
npx eslint
--no-error-on-unmatched-pattern
--ext
=
.yml
$ESLINT_FIX
.
&&
echo
"ESLint passed."
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
DEBUG
=
$(
[[
"
$1
"
==
"debug"
]]
&&
echo
"--debug"
||
echo
""
)
;
npx eslint
--no-error-on-unmatched-pattern
--ignore-pattern
=
vendor
--ignore-pattern
=
node_modules
--ext
=
.yml
$DEBUG
$ESLINT_FIX
.
&&
echo
"ESLint passed."
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
[[
"
$1
"
==
"fix"
]]
&&
vendor/bin/phpcbf
--colors
scripts/
*
.php
-s
vendor/bin/phpcs
--colors
scripts/
*
.php
-s
&&
echo
"PHPCS passed."
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
VERBOSE
=
$(
[[
"
$1
"
==
"debug"
]]
&&
echo
"-v"
||
echo
""
)
;
vendor/bin/phpcs
--colors
scripts/
*
.php
-s
$VERBOSE
&&
echo
"PHPCS passed."
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
shellcheck scripts/
*
.sh
&&
echo
"Shellcheck passed."
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
php scripts/unformatted-links.php
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
php scripts/unformatted-links.php
$VERBOSE
||
EXIT_CODE
=
$((
EXIT_CODE+1
))
[[
"
$EXIT_CODE
"
!=
0
]]
&&
echo
-e
"
\n
===========================
\n
Number of failed checks:
$EXIT_CODE
\n
===========================
\n
"
||
echo
"= All OK ="
# Clean up all files that were copied.
Loading