Skip to content

Commit ced1453

Browse files
committed
fix links and typos
1 parent f4fef09 commit ced1453

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

article/article.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ Here are the linters and checks we are going to use:
2828

2929
**Disclaimer**: author assumes you are familiar with the above-mentioned linters, tools, and checks.
3030

31-
I would like to share how to configure them for the python project. I prepared a full [github actions python configuration demo repository](https://github.com/iamtodor/demo-github-actions-python-configuration).
31+
I would like to share how to configure them for the python project. I prepared a full [github actions python configuration demo repository](https://github.com/iamtodor/demo-github-actions-python-linter-configuration).
3232

3333
We use `flakeheaven` as a `flake8` wrapper, which is very easy to configure in one single `pyproject.toml`. The whole `pyproject.toml` configuration file can be found in
34-
a [demo repo](https://github.com/iamtodor/demo-github-actions-python-configuration/blob/main/pyproject.toml).
34+
a [demo repo](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/pyproject.toml).
3535

36-
![pyproject.toml](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/flakeheaven-pyproject-config.png?raw=true)
36+
![pyproject.toml](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/flakeheaven-pyproject-config.png?raw=true)
3737

3838
I would say the config file is self-explainable, so I will not stop here for long. Just a few notes about tiny tweaks.
3939

@@ -61,7 +61,7 @@ utils.py
6161

6262
We are ok if not every module will be documented. We are also ok if not every function or method will be documented. We are not going to push documentation for documentation's sake. So we want to disable `C0114` and `C0116` checks from pylint.
6363

64-
![flakeheaven disable docs](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/flakeheaven-disable-docs.png?raw=true)
64+
![flakeheaven disable docs](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/flakeheaven-disable-docs.png?raw=true)
6565

6666
#### Import error
6767

@@ -81,9 +81,9 @@ dags/dummy.py
8181

8282
So we need to disable `E0401` check from `pylint`.
8383

84-
![flakeheaven disable import checks](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/flakeheaven-disable-import-checks.png?raw=true)
84+
![flakeheaven disable import checks](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/flakeheaven-disable-import-checks.png?raw=true)
8585

86-
We assume that the developer who writes the code and imports the libs is responsible for the writing reliable tests. So if the test does not pass it means that it's something with the import or code (logic) itself. Thus the import check is not something we would like to put as a linter job.
86+
We assume that the developer who writes the code and imports the libs is responsible for writing reliable tests. So if the test does not pass it means that it's something with the import or code (logic) itself. Thus, the import check is not something we would like to put as a linter job.
8787

8888
Also, there is another possible solution to disable this check by including `# noqa: E0401` after the import statement.
8989

@@ -96,7 +96,7 @@ from airflow.operators.dummy_operator import DummyOperator # noqa: E0401
9696

9797
To configure code for Airflow DAGs there are also a few tweaks. Here is the dummy example `dummy.py`.
9898

99-
![python dummy DAG](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/python-airflow-tasks-order.png?raw=true)
99+
![python dummy DAG](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/python-airflow-tasks-order.png?raw=true)
100100

101101
If we run `flakeheaven` with the default configuration we would see the following error:
102102

@@ -117,7 +117,7 @@ dags/dummy.py
117117

118118
However, we want to keep each task specified in a new line, hence we need to disable `W503` from pycodestyle.
119119

120-
![disable W503](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/flakeheaven-diable-line-break-W503.png?raw=true)
120+
![disable W503](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/flakeheaven-diable-line-break-W503.png?raw=true)
121121

122122
Next, with the default configuration we would get the next warning:
123123

@@ -132,7 +132,7 @@ dags/dummy.py
132132

133133
This is about how we specify task order. The workaround here is to exclude `W0104` from pylint.
134134

135-
![disable W0104](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/flakeheaven-disable-statement-no-effect-W0104.png?raw=true)
135+
![disable W0104](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/flakeheaven-disable-statement-no-effect-W0104.png?raw=true)
136136

137137
More info about rules could be found on [flake8 rules page](https://www.flake8rules.com/).
138138

@@ -142,53 +142,53 @@ More info about rules could be found on [flake8 rules page](https://www.flake8ru
142142

143143
We configure GitHub Workflow to be triggered on every PR against the main (master) branch.
144144

145-
The whole `py_linter.yml` config can be found in a [demo repo](https://github.com/iamtodor/demo-github-actions-python-configuration/blob/main/.github/workflows/py_linter.yml). I will walk you through it step by step.
145+
The whole `py_linter.yml` config can be found in a [demo repo](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/.github/workflows/py_linter.yml). I will walk you through it step by step.
146146

147-
![py_linter.yml](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-full.png?raw=true)
147+
![py_linter.yml](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-full.png?raw=true)
148148

149149
### When to run it
150150

151151
We are interested in running linter only when a PR has `.py` files. For instance, when we update `README.md` there is no sense in running a python linter.
152152

153-
![configure run workflow on PRs and push](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-py-push-pr.png?raw=true)
153+
![configure run workflow on PRs and push](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-py-push-pr.png?raw=true)
154154

155155
### What files does it run against
156156

157157
We are interested in running a linter only against the modified files. Let's say, we take a look at the provided repo, if I update `dags/dummy.py` I don't want to waste time and resources running the linter against `main.py`. For this purpose we use [Paths Filter GitHub Action](https://github.com/dorny/paths-filter), which is very flexible.
158158

159-
![Paths Filter GitHub Action](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-paths-filter.png?raw=true)
159+
![Paths Filter GitHub Action](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-paths-filter.png?raw=true)
160160

161161
If we have modified a `.py` file and any other files such as `.toml` in one PR, we don't want to run a linter against the non-python files, so we configure filtering only for `.py` files no matter the location: root, tests, src, etc.
162162

163-
The changed file can have the following statuses: `added`, `modified`, or `deleted`. There is no reason to run the linter against deleted files as your workflow would simply fail, because that particular changed file is no longer in the repo. So we need to configure what changes we consider to trigger the linter.
163+
The changed file can have the following statuses: `added`, `modified`, or `deleted`. There is no reason to run the linter against deleted files as your workflow would simply fail, because that particular changed file is no longer in the repo. So we need to configure what changes we consider triggering the linter.
164164

165-
![added|modified](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-added-modified.png?raw=true)
165+
![added|modified](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-added-modified.png?raw=true)
166166

167167
I define the variable where I can find the output (only the `.py` files) from the previous filter. This variable would contain modified `.py` files that I can further pass to a `flakeheaven`, `black`, and `isort`. By default, the output is disabled and "Paths Changes Filter" allows you to customize it: you can list the files in `.csv`, `.json`, or in a `shell` mode. Linters accept files separated simply by space, so our choice here is `shell` mode.
168168

169-
![list files shell](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-list-files-shell.png?raw=true)
169+
![list files shell](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-list-files-shell.png?raw=true)
170170

171171
### Run linter itself
172172

173173
The next and last step is to run the linter itself.
174174

175-
![run linter step](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-run-linter-step.png?raw=true)
175+
![run linter step](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-run-linter-step.png?raw=true)
176176

177177
Before we run the linter on changed files we run a check to see if there are actual changes in `.py` files by checking if there are any `.py` files from the previous step.
178178

179-
![check if there are .py files](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-run-linter-check-for-changes.png?raw=true)
179+
![check if there are .py files](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-run-linter-check-for-changes.png?raw=true)
180180

181181
Next, using the before-mentioned output variable we can safety pass the content from this `steps.filter.outputs.py_scripts_filter_files` variable to linter.
182182

183-
![linter commands](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/gh-config-run-linter-commands.png?raw=true)
183+
![linter commands](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/gh-config-run-linter-commands.png?raw=true)
184184

185185
## Conclusion
186186

187187
That's all I would like to share. I hope it is useful for you, and that you can utilize this experience and knowledge.
188188

189-
I wish you to see these success checks every time you push your code :)
189+
I wish you to see these successful checks every time you push your code :)
190190

191-
![success linter](https://github.com/iamtodor/github-actions-python-configuration-demo/blob/main/article/img/linter-success.png?raw=true)
191+
![success linter](https://github.com/iamtodor/demo-github-actions-python-linter-configuration/blob/main/article/img/linter-success.png?raw=true)
192192

193193
If you have any questions feel free to ask in a comment section, I will do my best to provide a comprehensive answer for you.
194194

0 commit comments

Comments
 (0)