Github actions is a recent addition to the Github eco-system and allows you to perform a series of actions whenever a supported Github “event” occurs. Your CI pipeline can use this mark in conjunction with an appropriate threshold to determine if your code passes the linting stage and can progress to the next stage of your pipeline. When you run Pylint against your code, as well as reporting any issues it discovers, it takes all the problems it finds into account and, conveniently, gives it a mark out of ten for “correctness”, with 10/10 meaning the code is perfect. This means they will highlight issues such as a lack of white space around operators for instance. The types of issues they can detect vary but some common examples would be general syntax errors, unreachable sections of code, unused arguments etc … They can also check that your code agrees with a particular coding standard such as PEP8 for Python. Linters don’t check the logic of your code, just the syntax. They pick up bits of “fluff” from your code, hence the name. Linters check source code for errors and various other issues. Let’s talk about Pylint first. Pylint is a linter. This is free to set up, just head over to and sign up. You can install this from your command line using pip (or conda) $ pip install pylintĪnd finally, you need a Github account. I’m assuming you have python and pip (or conda) installed on your local system. Some knowledge of Github and Python would be great. Check if the code passes the lint test.Install pylint to do a static code analysis on our python module.Setting up a Github action on a push change to our Github repository that does the following:.Using pylint to check our python module for syntax errors and other issues.In my next couple of LinkedIn articles, I’m going to talk about how to use the fairly new Github Actions functionality within Github to implement a simple Continuous Integration/Continuous Deployment (CI/CD) pipeline for a Python project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |