Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
Mirrored projects
polkadot-sdk
Commits
7fb3dc5f
Commit
7fb3dc5f
authored
5 years ago
by
gabriel klawitter
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
check line-width of only newly added lines (#2522)
* strictly require <= 120 characters
parent
3b0eca99
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/.gitlab-ci.yml
+13
-1
13 additions, 1 deletion
substrate/.gitlab-ci.yml
substrate/scripts/gitlab/check_line_width.sh
+49
-0
49 additions, 0 deletions
substrate/scripts/gitlab/check_line_width.sh
with
62 additions
and
1 deletion
substrate/.gitlab-ci.yml
+
13
−
1
View file @
7fb3dc5f
...
...
@@ -52,6 +52,18 @@ check-runtime:
script
:
-
./scripts/gitlab/check_runtime.sh
check-line-width
:
stage
:
test
image
:
parity/tools:latest
<<
:
*kubernetes-build
only
:
-
/^[0-9]+$/
script
:
-
./scripts/gitlab/check_line_width.sh
allow_failure
:
false
test-linux-stable
:
&test
stage
:
test
variables
:
...
...
@@ -81,7 +93,7 @@ test-linux-stable: &test
check-web-wasm
:
stage
:
test
image
:
tomaka/cargo-web:latest
allow_failure
:
true
allow_failure
:
true
only
:
-
master
-
/^[0-9]+$/
...
...
This diff is collapsed.
Click to expand it.
substrate/scripts/gitlab/check_line_width.sh
0 → 100755
+
49
−
0
View file @
7fb3dc5f
#!/bin/sh
#
# check if line width of rust source files is not beyond x characters
#
BASE_BRANCH
=
"origin/master"
LINE_WIDTH
=
"121"
GOOD_LINE_WIDTH
=
"101"
git diff
--name-only
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
\*
.rs |
(
while
read
file
do
if
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
|
grep
-q
"^+.
\{
${
LINE_WIDTH
}
\}
"
then
if
[
-z
"
${
FAIL
}
"
]
then
echo
"| warning!"
echo
"| Lines should not be longer than 120 characters."
echo
"| "
echo
"| see more https://wiki.parity.io/Substrate-Style-Guide"
echo
"|"
FAIL
=
"true"
fi
echo
"| file:
${
file
}
"
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
\
|
grep
-n
"^+.
\{
${
LINE_WIDTH
}
\}
"
echo
"|"
else
if
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
|
grep
-q
"^+.
\{
${
GOOD_LINE_WIDTH
}
\}
"
then
if
[
-z
"
${
FAIL
}
"
]
then
echo
"| warning!"
echo
"| Lines should be longer than 100 characters only in exceptional circumstances!"
echo
"| "
echo
"| see more https://wiki.parity.io/Substrate-Style-Guide"
echo
"|"
fi
echo
"| file:
${
file
}
"
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
\
|
grep
-n
"^+.
\{
${
LINE_WIDTH
}
\}
"
echo
"|"
fi
fi
done
test
-z
"
${
FAIL
}
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
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