Skip to content

Commit ae5cc03

Browse files
committed
Adds more lint info
1 parent 93e0171 commit ae5cc03

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

pipeline/lint.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
# Lint
22

3-
You can put a lint image and analize the code and on the next stage publish the results using another image. The previous image is completed descarted and does not interfere in the final production image. See the example below:
3+
## Choosing the rules
44

5-
FROM cytopia/docker-pylint:latest as linter
5+
There are several sets of linting rules for every program language. For Python theese rules are defiened in a document [called PEP8](https://pep8.org/).
66

7-
COPY src /data
7+
The more rules better results, so a good start point is the Pylama package that combines several linters together.
88

9-
RUN pylint /data
9+
To understand python linterd I suggest you to read the article:
1010

11-
...
11+
[Python Code Quality: Tools & Best Practices](https://realpython.com/python-code-quality/#style-guides)
1212

13-
FROM python:3.8-slim as production
13+
See the example below:
1414

15-
COPY src /app
15+
```dockerfile
16+
FROM cytopia/docker-pylint:latest as linter
1617

17-
USER app
18+
COPY s rc /data
1819

19-
CMD["python", "/app/start.py"]
20+
RUN pylint /data
21+
22+
...
23+
24+
FROM python:3.8-slim as production
25+
26+
COPY src /app
27+
28+
USER app
29+
30+
CMD["python", "/app/start.py"]
31+
```
2032

2133
In this Dockerfile we are using two images. The lint image and a python for production. The images are both used to create containers but only the last image will be used to create the final image.

0 commit comments

Comments
 (0)