Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eic_tools
Spack
Commits
78d25ad3
Commit
78d25ad3
authored
9 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Patches
Plain Diff
Add run-flake8 script.
- was missing the obvious.
parent
c512b37a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
share/spack/qa/run-flake8
+55
-0
55 additions, 0 deletions
share/spack/qa/run-flake8
with
55 additions
and
0 deletions
share/spack/qa/run-flake8
0 → 100755
+
55
−
0
View file @
78d25ad3
#!/bin/bash
#
# This script runs source code style checks on Spack.
#
# It should be executed from the top-level directory of the repo,
# e.g.:
#
# share/spack/qa/run-flake8
#
# To run it, you'll need to have the Python flake8 installed locally.
#
PYTHONPATH
=
./lib/spack:
$PYTHONPATH
flake8
=
"
$(
which flake8
)
"
if
[[
!
$flake8
]]
;
then
echo
"ERROR: flake8 is required to run this script."
exit
1
fi
# Check if changed files are flake8 conformant [framework]
changed
=
$(
git diff
--name-only
develop... |
grep
'.py$'
)
# Exempt url lines in changed packages from overlong line errors.
for
file
in
$changed
;
do
if
[[
$file
=
*
package.py
]]
;
then
perl
-i
~
-pe
's/^(\s*url\s*=.*)$/\1 # NOQA: ignore=E501/'
$file
;
fi
done
return_code
=
0
if
[[
$changed
]]
;
then
echo
=======================================================
echo
flake8: running flake8 code checks on spack.
echo
echo
Modified files:
echo
$changed
| perl
-pe
's/^/ /;s/ +/\n /g'
echo
=======================================================
if
flake8
--format
pylint
$changed
;
then
echo
"Flake8 checks were clean."
else
echo
"Flake8 found errors."
return_code
=
1
fi
else
echo
No core framework files modified.
fi
# Restore original package files after modifying them.
for
file
in
$changed
;
do
if
[[
$file
=
*
package.py
]]
;
then
mv
"
${
file
}
~"
"
${
file
}
"
fi
done
exit
$return_code
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment