Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Python
Manage
Activity
Members
Plan
Wiki
Code
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
Analyze
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
to be continuous...
Python
Commits
e8e068ba
Unverified
Commit
e8e068ba
authored
1 year ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
feat: add isort job
Signed-off-by:
Lars Bilke
<
lars.bilke@ufz.de
>
parent
054b0403
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+9
-0
9 additions, 0 deletions
README.md
kicker.json
+6
-0
6 additions, 0 deletions
kicker.json
templates/gitlab-ci-python.yml
+18
-0
18 additions, 0 deletions
templates/gitlab-ci-python.yml
with
33 additions
and
0 deletions
README.md
+
9
−
0
View file @
e8e068ba
...
...
@@ -274,6 +274,15 @@ This job **disabled by default** and runs [black](https://black.readthedocs.io)
| ---------------- | ----------------------------------------------------------------------- | ----------------- |
|
`black-enabled`
/
`PYTHON_BLACK_ENABLED`
| Set to
`true`
to enable black job | _none_ (disabled) |
### `py-isort` job
This job
**disabled by default**
and runs
[
isort
](
https://pycqa.github.io/isort/
)
on the repo. It is bound to the build stage.
| Input / Variable | Description | Default value |
| ---------------- | ----------------------------------------------------------------------- | ----------------- |
|
`isort-enabled`
/
`PYTHON_ISORT_ENABLED`
| Set to
`true`
to enable isort job | _none_ (disabled) |
### SonarQube analysis
If you're using the SonarQube template to analyse your Python code, here is a sample
`sonar-project.properties`
file:
...
...
This diff is collapsed.
Click to expand it.
kicker.json
+
6
−
0
View file @
e8e068ba
...
...
@@ -246,6 +246,12 @@
"name"
:
"black"
,
"description"
:
"Code formatting based on [black](https://black.readthedocs.io)"
,
"enable_with"
:
"PYTHON_BLACK_ENABLED"
},
{
"id"
:
"isort"
,
"name"
:
"isort"
,
"description"
:
"Check imports order with [isort](https://pycqa.github.io/isort)"
,
"enable_with"
:
"PYTHON_ISORT_ENABLED"
}
],
"variants"
:
[
...
...
This diff is collapsed.
Click to expand it.
templates/gitlab-ci-python.yml
+
18
−
0
View file @
e8e068ba
...
...
@@ -151,6 +151,10 @@ spec:
description
:
Enable black
type
:
boolean
default
:
false
isort-enabled
:
description
:
Enable isort
type
:
boolean
default
:
false
---
# default workflow rules: Merge Request pipelines
workflow
:
...
...
@@ -265,6 +269,7 @@ variables:
PYTHON_RELEASE_ENABLED
:
$[[ inputs.release-enabled ]]
PYTHON_BLACK_ENABLED
:
$[[ inputs.black-enabled ]]
PYTHON_ISORT_ENABLED
:
$[[ inputs.isort-enabled ]]
.python-scripts
:
&python-scripts
|
...
...
@@ -879,6 +884,19 @@ py-black:
when
:
never
-
!reference
[
.test-policy
,
rules
]
py-isort
:
extends
:
.python-base
stage
:
build
script
:
-
install_requirements
-
_pip install isort
-
_run isort . --check-only
rules
:
# exclude if $PYTHON_ISORT_ENABLED not set
-
if
:
'
$PYTHON_ISORT_ENABLED
!=
"true"'
when
:
never
-
!reference
[
.test-policy
,
rules
]
###############################################################################################
# test stage #
###############################################################################################
...
...
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
mentioned in commit
b786f332
·
1 year ago
mentioned in commit
b786f332
mentioned in commit b786f3329e6c8295e8812b28e3419cc71876624a
Toggle commit list
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