Skip to content

Commit

Permalink
feat: add prettier as formatter (yaml, json, md, etc.) (#298)
Browse files Browse the repository at this point in the history
* feat: prettier added to the project and precommit

* feat: recommend vscode extension

* fix: adjusted prettier

* fix: all files reformated by prettier

* fix: unnecessary comment
  • Loading branch information
d0choa authored Dec 5, 2023
1 parent 6118bb9 commit ae68d84
Show file tree
Hide file tree
Showing 58 changed files with 402 additions and 378 deletions.
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ repos:
- id: check-json
- id: check-toml
- id: check-yaml
- id: pretty-format-json
args:
- --autofix
- --no-ensure-ascii
- --no-sort-keys
- id: check-ast
- id: debug-statements
- id: check-docstring-first
Expand Down Expand Up @@ -96,3 +91,9 @@ repos:
rev: 0.3.8
hooks:
- id: pydoclint

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: prettier
args: ["--staged"]
7 changes: 3 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"ms-python.isort",
"ms-python.mypy-type-checker",
"ms-python.python",
"ms-python.black-formatter"
"ms-python.black-formatter",
"esbenp.prettier-vscode"
],
"unwantedRecommendations": [
"ms-python.flake8"
]
"unwantedRecommendations": ["ms-python.flake8"]
}
9 changes: 2 additions & 7 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"args": [
"--config-dir=./configs"
]
"args": ["--config-dir=./configs"]
},
{
"name": "Python: Current File [local]",
Expand All @@ -19,10 +17,7 @@
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"args": [
"--config-dir=./configs",
"environment=local"
]
"args": ["--config-dir=./configs", "environment=local"]
}
]
}
17 changes: 3 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
"source.organizeImports": true
}
},
"python.terminal.launchArgs": [
"-m",
"IPython",
"--no-autoindent"
],
"python.terminal.launchArgs": ["-m", "IPython", "--no-autoindent"],
"[jsonc]": {
"editor.tabSize": 2,
"editor.insertSpaces": true,
Expand All @@ -23,16 +19,9 @@
}
},
"json.format.keepLines": true,
"isort.args": [
"--profile",
"black"
],
"isort.args": ["--profile", "black"],
"autoDocstring.docstringFormat": "google",
"python.testing.pytestArgs": [
".",
"--doctest-modules",
"--cov=src/"
],
"python.testing.pytestArgs": [".", "--doctest-modules", "--cov=src/"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"mypy-type-checker.severity": {
Expand Down
366 changes: 183 additions & 183 deletions LICENSE.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/opentargets/genetics_etl_python/main.svg)](https://results.pre-commit.ci/badge/github/opentargets/genetics_etl_python)

# Genetics Portal Data Pipeline (experimental)

- [Documentation](https://opentargets.github.io/genetics_etl_python/)
3 changes: 1 addition & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false # if true: only post the comment if coverage changes
require_changes: false # if true: only post the comment if coverage changes

coverage:
status:
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
module.exports = { extends: ["@commitlint/config-conventional"] };
6 changes: 3 additions & 3 deletions docs/assets/javascripts/extra.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$('.contributors img[data-src]').each(function () {
src = $(this).attr("data-src");
$(this).attr('src', src);
$(".contributors img[data-src]").each(function () {
src = $(this).attr("data-src");
$(this).attr("src", src);
});
86 changes: 45 additions & 41 deletions docs/assets/overrides/partials/source-file.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
<hr />
<div class="md-source-file">
<small>
<ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
<!-- mkdocs-git-revision-date-plugin -->
{% if page.meta.git_creation_date_localized %}
<li>
<span class="icon twemoji">
{% include ".icons/material/clock-plus-outline.svg" %}
</span>
<span class="label">
{{ page.meta.git_creation_date_localized }}
</span>
</li>
{% endif %}
<small>
<ul
class="metadata page-metadata"
data-bi-name="page info"
lang="en-us"
dir="ltr"
>
<!-- mkdocs-git-revision-date-plugin -->
{% if page.meta.git_creation_date_localized %}
<li>
<span class="icon twemoji">
{% include ".icons/material/clock-plus-outline.svg" %}
</span>
<span class="label"> {{ page.meta.git_creation_date_localized }} </span>
</li>
{% endif %} {% if page.meta.git_revision_date_localized %}
<li>
<span class="icon twemoji">
{% include ".icons/material/clock-edit-outline.svg" %}
</span>
<span class="label"> {{ page.meta.git_revision_date_localized }} </span>
</li>
{% endif %}

{% if page.meta.git_revision_date_localized %}
<li>
<span class="icon twemoji">
{% include ".icons/material/clock-edit-outline.svg" %}
</span>
<span class="label">
{{ page.meta.git_revision_date_localized }}
</span>
</li>
{% endif %}

<li>
<span class="icon twemoji">
{% include ".icons/material/github.svg" %}
</span>
<span class="label">
Contributors
</span>
</li>
<li class="contributors-holder">
<ul class="contributors" data-bi-name="contributors">
{%- for user in committers -%}
<li><a href="{{ user.url }}" title="{{ user.name }}" data-bi-name="contributorprofile"
target="_blank"><img src="{{ user.avatar }}" alt="{{ user.name }}"></a></li>
{%- endfor -%}
</ul>
</li>
<li>
<span class="icon twemoji">
{% include ".icons/material/github.svg" %}
</span>
<span class="label"> Contributors </span>
</li>
<li class="contributors-holder">
<ul class="contributors" data-bi-name="contributors">
{%- for user in committers -%}
<li>
<a
href="{{ user.url }}"
title="{{ user.name }}"
data-bi-name="contributorprofile"
target="_blank"
><img src="{{ user.avatar }}" alt="{{ user.name }}"
/></a>
</li>
{%- endfor -%}
</ul>
</small>
</li>
</ul>
</small>
</div>
90 changes: 43 additions & 47 deletions docs/assets/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,79 +1,75 @@
.metadata {
list-style: none;
padding: 0;
margin: 0;
margin-bottom: 15px;
color: #999;
list-style: none;
padding: 0;
margin: 0;
margin-bottom: 15px;
color: #999;
}

.metadata.page-metadata .contributors-text {
margin-right: 5px;
display: inline-block;
margin-right: 5px;
display: inline-block;
}

.metadata.page-metadata {
display: flex !important;
flex-direction: row;
align-items: center;
font-size: 1.2em;
display: flex !important;
flex-direction: row;
align-items: center;
font-size: 1.2em;
}


.metadata.page-metadata li {
list-style: none;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-bottom: 0 !important;
list-style: none;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-bottom: 0 !important;
}


.metadata.page-metadata li .icon {
width: 1.1rem;
height: 1.1rem;
margin-right: 2px;
width: 1.1rem;
height: 1.1rem;
margin-right: 2px;
}


.metadata.page-metadata li .icon svg {
fill: #999;
fill: #999;
}


.page-metadata .contributors-holder {
margin: 0 !important;
margin-left: 1em;
margin: 0 !important;
margin-left: 1em;
}

.page-metadata .contributors {
margin-right: 5px;
display: inline-block;
list-style: none;
display: flex;
flex-direction: row;
margin-right: 5px;
display: inline-block;
list-style: none;
display: flex;
flex-direction: row;
}

.page-metadata .contributors li {
display: inline-flex;
margin: 0 !important;
padding: 0 !important;
display: inline-flex;
margin: 0 !important;
padding: 0 !important;
}

.page-metadata .contributors li img {
border-radius: 50%;
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
opacity: 0.8;
vertical-align: middle;
width: 1.6rem;
transition: all 0.2s ease-in-out;
border-radius: 50%;
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
opacity: 0.8;
vertical-align: middle;
width: 1.6rem;
transition: all 0.2s ease-in-out;
}

.page-metadata .contributors li img:hover {
opacity: 1;
filter: grayscale(0%);
-webkit-filter: grayscale(0%);
vertical-align: middle;
transform: scale(1.2);
opacity: 1;
filter: grayscale(0%);
-webkit-filter: grayscale(0%);
vertical-align: middle;
transform: scale(1.2);
}
Loading

0 comments on commit ae68d84

Please sign in to comment.