Developers often face issues while writing their codes for Linux and Unix OSs from their Windows laptop. Most problems occurs when developers codes those programs or scripts which use indentation like Python and Ansible as these languages follow strict indentation rules and may create errors with incorrect indentation while running the codes or during lint check whereas, some scripting and programming languages does not require indentation but as a best practice developers still opt to use indentation for better way to represent the relationship between control flow construction like representing the selection statements, loops and code contained within and outside them.
Another issue occurs while running those coded programs or scripts files after transferring from Windows to Linux or other Unix OSs is, these OSs failed to understand the file format of program or script which were coded through dos format supported Windows text editors such as notepad. Therefore, there is needs of source code editor for Windows OS which facilitates in writing the code, debugging the code, check the incorrect indentation errors and suggest the fixes and also can save the code in relevant program or script file format which should be readable and executed by Unix OSs after copying it.
For addressing these requirements, I use Microsoft Visual Studio Code source editor. You can download and install the Visual Studio Code Source editor from official Microsoft site: https://code.visualstudio.com/
While writing this Article I am using below Visual Studio Code source editor version on my Windows 10 laptop:
Visual Studio Code (VS Code) Source editors provides you numbers of extensions from its marketplace which are suitable for validating different programing, scripting languages indentations and text files formatting such as GitHub Readme.md file. It eases the developers to write and validate their codes before moving it to the production environment. In this below example I will show you how to install the lint extensions for validating Ansible YAML playbook indentation and GitHub Readme file formatting.
- Installing Ansible YAML playbook indentation lint validating extension
- Open VS Code editor
- Click on Extension icon box or press shift + ctrl + X for accessing Extensions marketplace:
- Search for Red Hat Ansible lint extension and click on install:
- Click on Trust Workspace & Install button:
- Now open any Ansible YAML playbook if there is any indentation lint issue in playbook VS Code will immediately highlight the issue and will suggest the fix for that issue as well.
- Installing GitHub Readme file markdown lint validating extension
- Access the Extensions marketplace in same way as I have mentioned in previous procedure.
- Search for markdownlint extension and install it:
- After installing the markdownlint extension open any GitHub Readme file in your system and if in case there is any markdown lint issue in Readme file this lint extension will immediately highlight it and also will provide the suggestion for fixing it:
Conclusion
As per the above example you can see how VS Code source editor helped in fixing the ansible playbook indentation issue it also helped in standardizing the formatting of GitHub Readme file as well.