Skip to content

Commit

Permalink
feat: add prettier to pre-commit (#427)
Browse files Browse the repository at this point in the history
* add prettier

* add prettier fixes

* add var name to formatter

* add "" to Lineage

* fmt table formatter

* dont check fomatter

* run pre-commits
  • Loading branch information
thomasbtf authored Jan 3, 2022
1 parent 0245c9f commit e7cb0a7
Show file tree
Hide file tree
Showing 35 changed files with 34,997 additions and 913 deletions.
9 changes: 5 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: 🐛 Bug report
about: If something isn't working
title: ''
title: ""
labels: bug
assignees:
---
Expand All @@ -12,9 +12,9 @@ assignees:
Please only report bugs of the **latest release of UnCoVar**.
If possible, please check whether the bug has been already fixed in the master branch. -->

* UnCoVar version: [ see version.txt ]
* OS: [ Linux / Windows / macOS ]
* Snakemake version: [ `snakemake -v` ]
- UnCoVar version: [ see version.txt ]
- OS: [ Linux / Windows / macOS ]
- Snakemake version: [ `snakemake -v` ]

## Bug Report

Expand All @@ -26,6 +26,7 @@ If possible, please check whether the bug has been already fixed in the master b
That includes the executed command and a reference to the used sample. -->

## Logs

<!-- Any terminal output to help explain your problem. -->

## Additional context
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: 🚀 Feature request
about: Suggest an idea for this project
title: ''
title: ""
labels: enhancement
assignees:
---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: ❓ Question
about: Ask a question about this project
title: ''
title: ""
labels: question
assignees:
---
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/copyright-preamble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ jobs:
# Licensed under the BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
# This file may not be copied, modified, or distributed
# except according to those terms.\n
FileType: '.py, .smk, Snakefile'
Path: 'workflow/rules/, workflow/scripts/'
IgnorePath: ''
FileType: ".py, .smk, Snakefile"
Path: "workflow/rules/, workflow/scripts/"
IgnorePath: ""

# Creates pull request with all changes in file
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: 'chore: update copyright preamble'
commit-message: "chore: update copyright preamble"
delete-branch: true
title: 'chore: update copyright preamble'
title: "chore: update copyright preamble"
body: |
This PR updates the copyright preamble in .smk and .py files.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
branches:
- master
paths:
- '**.md'
- 'docs/**'
- 'mkdocs.yml'
- "**.md"
- "docs/**"
- "mkdocs.yml"
# Also trigger on page_build, as well as release created events
page_build:
release:
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
with:
workflows: "main.yml"
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'

GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Formatting:
runs-on: ubuntu-latest
Expand All @@ -35,7 +34,6 @@ jobs:
VALIDATE_PYTHON_BLACK: true
VALIDATE_MARKDOWN: true


Linting:
runs-on: ubuntu-latest
env:
Expand All @@ -50,15 +48,13 @@ jobs:
stagein: mamba install -n snakemake -c conda-forge peppy
args: "--lint"


Pre-Commit:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

Technology-Tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -186,7 +182,16 @@ jobs:
- Pre-Commit
strategy:
matrix:
rule: [benchmark_strain_calling, benchmark_assembly, benchmark_mixtures, benchmark_non_sars_cov_2, benchmark_reads, compare_assemblers, generate_test_cases]
rule:
[
benchmark_strain_calling,
benchmark_assembly,
benchmark_mixtures,
benchmark_non_sars_cov_2,
benchmark_reads,
compare_assemblers,
generate_test_cases,
]
steps:
- uses: actions/checkout@v2

Expand All @@ -197,7 +202,6 @@ jobs:
# .tests/.snakemake/conda
# key: benchmarks-${{ runner.os }}-${{ matrix.rule }}-${{ matrix.technology }}-${{ matrix.seq_method }}-${{ hashFiles('*.tests/.snakemake/conda/*.yaml') }}


# TODO caches are currently completely misleading, as they lead to certain files becoming present on disk which might
# then hide failures that would otherwise be seen.

Expand Down Expand Up @@ -279,7 +283,6 @@ jobs:
# ${{ runner.os }}-sars-cov-benchmark-dependencies-${{ steps.get-date.outputs.date }}-
# ${{ runner.os }}-sars-cov-benchmark-dependencies-


- name: Prepare test data
if: matrix.rule == 'generate_test_cases'
run: |
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
env:
GISAID_API_TOKEN: ${{ secrets.GISAID_API_TOKEN }}
steps:

- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
Expand Down Expand Up @@ -59,9 +58,9 @@ jobs:
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'
remove-haskell: 'true'
remove-android: 'true'
remove-dotnet: "true"
remove-haskell: "true"
remove-android: "true"

- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -111,7 +110,7 @@ jobs:
with:
directory: .
snakefile: workflow/Snakefile
task: 'containerize'
task: "containerize"

- name: Debug print
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/update-pangolin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Check for new pangolin Release

on:
schedule:
# At the end of every day
- cron: '0 0 * * *'
# At the end of every day
- cron: "0 0 * * *"

jobs:
Create-PR-for-new-Pangolin-release:
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: pangolin-update-to-${{ env.LATEST_PANGOLIN }}
delete-branch: true
title: 'build: update Pangolin to ${{ env.LATEST_PANGOLIN }}'
title: "build: update Pangolin to ${{ env.LATEST_PANGOLIN }}"
body: |
Hey there, a new release of Pangolin is available: [${{ env.LATEST_PANGOLIN }}](https://github.com/cov-lineages/pangolin/releases/tag/v${{ env.LATEST_PANGOLIN }})
Expand Down
43 changes: 24 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,49 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "^publication/|CHANGELOG.md|docs/index.md|.github/pull_request_template.md"
exclude: "^publication/|CHANGELOG.md|docs/index.md|.github/pull_request_template.md|resources/report-table-formatter.js"

default_stages: [commit, push]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: ^config/multiqc_config_lab.yaml|.tests/config/multiqc_config_lab.yaml
- id: check-added-large-files
- id: no-commit-to-branch
- id: check-added-large-files
- id: no-commit-to-branch

- repo: https://github.com/snakemake/snakefmt
- repo: https://github.com/snakemake/snakefmt
rev: 0.4.4
hooks:
- id: snakefmt
- id: snakefmt

- repo: https://github.com/psf/black
- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
- id: black-jupyter
- id: black
- id: black-jupyter

- repo: https://github.com/PyCQA/isort
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- id: isort

- repo: https://github.com/igorshubovych/markdownlint-cli
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.30.0
hooks:
- id: markdownlint-fix
- id: markdownlint-fix
args: [-c, .markdownlint.yaml]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
hooks:
- id: prettier

# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
autoupdate_schedule: weekly
skip: []
submodules: false
autoupdate_schedule: weekly
skip: []
submodules: false
2 changes: 0 additions & 2 deletions .tests/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ testing:
# flag for using genomes from genbank. Only for benchmarking purposes.
use-genbank: True


# genome to use as reference. Must be a NCBI accession
virus-reference-genome:
- NC_045512.2
Expand Down Expand Up @@ -102,7 +101,6 @@ assembly:
# minimum posterior probability for a clonal variant to be included in the generated pseudo-assembly
min-variant-prob: 0.95


strain-calling:
# minimum reported strain fraction after quantification
min-fraction: 0.02
Expand Down
1 change: 0 additions & 1 deletion .tests/config/multiqc_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module_order:
path_filters:
- "*quast-polished/*/report.tsv"


# sample name cleaning
fn_clean_exts:
- ".kreport2"
Expand Down
4 changes: 1 addition & 3 deletions .tests/config/multiqc_config_lab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ fn_clean_exts:
- "_S"
- ".1"

# customising general Statistics
table_columns_visible:
samtools-flagstat: False
Samtools: False
samtools: False

# customising general Statistics
table_columns_visible:
Species Diversity:
"% Severe acute respiratory syndrome-related coronavirus": True
"% Top 5": False
Expand Down
14 changes: 7 additions & 7 deletions .tests/resources/custom-stylesheet.css

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conda create -c conda-forge -c bioconda -n snakemake snakemake
```

For faster installation, you can use [`mamba`](https://github.com/mamba-org/mamba),
a reimplementation of the conda package manager in C++.
a reimplementation of the conda package manager in C++.

```bash
mamba create -c conda-forge -c bioconda -n snakemake snakemake
Expand Down Expand Up @@ -75,9 +75,9 @@ To run individual hooks use `pre-commit run <hook_id>`.
Follow the following steps to acquire a local copy of UnCoVar:

1. [Fork](https://help.github.com/en/articles/fork-a-repo) the original repo
to a personal or lab account.
to a personal or lab account.
1. [Clone](https://help.github.com/en/articles/cloning-a-repository) the
fork to your local system (to a different place than where you would run analysis).
fork to your local system (to a different place than where you would run analysis).
1. Implement your changes.

## Before Submitting
Expand All @@ -87,11 +87,11 @@ Before submitting your code, please do the following:
1. Add tests, if possible, for the new changes.
1. Edit documentation if you have changed something significant.
1. Make sure the [`pre-commit`](https://pre-commit.com/)
hooks had run (e.g. by `precommit run --all`).
hooks had run (e.g. by `precommit run --all`).
1. [Commit](https://git-scm.com/docs/git-commit)and [push](https://git-scm.com/docs/git-push)
your changes to your fork.
your changes to your fork.
1. Create a [pull request](https://help.github.com/en/articles/creating-a-pull-request)
against the original repository.
against the original repository.

## Testing

Expand Down
Loading

0 comments on commit e7cb0a7

Please sign in to comment.