Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

### Added
* Make linting optional [#568](https://github.com/NLeSC/python-template/pull/568)
* Make editorconfig optional [#571](https://github.com/NLeSC/python-template/pull/571)
* Make contributing guidelines optional [#465]()
* Make developer documentation optional [#467](https://github.com/NLeSC/python-template/pull/541)
Expand Down
14 changes: 6 additions & 8 deletions copier/questions/features_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SelectCodeQualityFeatures:
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[SelectGitHubActions_flag, not_implemented_linting, AddSonarCloud_flag, AddEditorConfig_flag]
[SelectGitHubActions_flag, AddLinting_flag, AddSonarCloud_flag, AddEditorConfig_flag]
{%- else -%}
[]
{%- endif %}
Expand All @@ -17,8 +17,8 @@ SelectCodeQualityFeatures:
GitHub Actions:
value: SelectGitHubActions_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Linting (using ruff NOT_IMPLEMENTED):
value: not_implemented_linting
Linting:
value: AddLinting_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Pre-commit:
value: AddPreCommit_flag
Expand Down Expand Up @@ -60,27 +60,25 @@ AddGitHubActionBuild:
type: bool
default: "{{ 'AddGitHubActionBuild_flag' in SelectGitHubActions }}"
when: false

AddGitHubActionDocumentation:
type: bool
default: "{{ 'AddGitHubActionDocumentation_flag' in SelectGitHubActions }}"
when: false

AddLinkCheck:
type: bool
default: "{{ 'AddLinkCheck_flag' in SelectGitHubActions }}"
when: false

AddPreCommit:
type: bool
default: "{{ 'AddPreCommit_flag' in SelectCodeQualityFeatures }}"
when: false

AddSonarCloud:
type: bool
default: "{{ 'AddSonarCloud_flag' in SelectCodeQualityFeatures }}"
when: false

AddLinting:
type: bool
default: "{{ 'AddLinting_flag' in SelectCodeQualityFeatures }}"
AddEditorConfig:
type: bool
default: "{{ 'AddEditorConfig_flag' in SelectCodeQualityFeatures }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- name: Verify that we can build the package
run: python -m build

{%- if AddLinting -%}
lint:
name: Linting build
runs-on: ubuntu-latest
Expand All @@ -62,3 +63,4 @@ jobs:
run: |
ruff check
ruff format --check
{%- endif -%}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on: [push]
permissions:
contents: write
issues: write
name: Create issues for next steps
name: Create issues for linting
jobs:
next_steps:
runs-on: ubuntu-latest
Expand All @@ -13,7 +13,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/next_steps/05_linting.md
filename: .github/workflows/next_steps_linting_issue.md
id: linting
- name: List created issues
run: |
Expand All @@ -23,7 +23,8 @@ jobs:
run: |
git config --global user.name 'NLeSC Python template'
git config --global user.email 'nlesc-python-template@users.noreply.github.com'
git rm .github/workflows/next_steps.yml
git rm -r .github/next_steps
git pull # other next step workflows may push changes before
git rm .github/workflows/next_steps_linting.yml
git rm .github/workflows/next_steps_linting_issue.md
git commit -am "Cleanup automated next steps issue generator"
git push
2 changes: 2 additions & 0 deletions template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ coverage report

`coverage` can also generate output in HTML and other formats; see `coverage help` for more information.

{%- if AddLinting -%}
## Running linters locally

For linting and sorting imports we will use [ruff](https://beta.ruff.rs/docs/). Running the linters requires an
Expand All @@ -76,6 +77,7 @@ ruff . --fix
```

To fix readability of your code style you can use [yapf](https://github.com/google/yapf).
{%- endif -%}

{%- if AddPreCommit -%}
You can enable automatic linting with `ruff` on commit by enabling the git hook from `.githooks/pre-commit`, like so:
Expand Down