Skip to content
Welcome To Charanjit Cheema Blog

Welcome To Charanjit Cheema Blog

An Open Source and Cloud Blog

Menu
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
Menu

How to fix code and text file linting errors with the help of Visual Studio Code

Posted on June 27, 2023 by Charanjit Cheema

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
  1. Open VS Code editor

 

  1. Click on Extension icon box or press shift + ctrl + X for accessing Extensions marketplace:

 

  1. Search for Red Hat Ansible lint extension and click on install:

 

  1. Click on Trust Workspace & Install button:

 

  1. 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
  1. Access the Extensions marketplace in same way as I have mentioned in previous procedure.
  2. Search for markdownlint extension and install it:

 

  1. 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.

Loading

  • Author
  • Recent Posts
Charanjit Cheema
Follow him
Charanjit Cheema
Charanjit is currently working as a Cloud Architect at Mphasis, with 17 years of experience in IT infrastructure projects, implementation, and support. While his main role is as a DevOps engineer, he holds a Cloud Architect position and has strong skills in cloud technologies and automation. His expertise includes Terraform, Ansible, AWS, Azure DevOps, Azure Cloud, VMware, and Linux systems.

Charanjit is passionate about automating tasks and improving processes. He uses tools like Terraform and Azure DevOps to build and manage cloud infrastructure and streamline deployment. He also enjoys using Shell scripts and Ansible playbooks to make systems run more efficiently.

In his free time, Charanjit enjoys learning about new technologies and sharing his knowledge through his blog. When he’s not working, he likes listening to music, having a cup of coffee, and relaxing in nature.

You can connect with Charanjit on Twitter, Facebook, LinkedIn, or email him at charanjit.cheema@cjcheema.com.
Charanjit Cheema
Follow him
Latest posts by Charanjit Cheema (see all)
  • How to optimize the performance of Ansible Automation Platform or Ansible Tower - July 16, 2023
  • How to fix code and text file linting errors with the help of Visual Studio Code - June 27, 2023
  • How to migrate existing WordPress blog from AWS EC2 instance to Amazon Lightsail - May 29, 2023

Like this:

Like Loading...

Related

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tags

AWS Cloud Computing Dockers Networking Open Networking OpenSource RHEL-CentOS SDN Server Hardware SLES tcpdump Ubuntu WSL

Follow me @

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Recent Posts

  • How to Deploy Docker Containers with NGINX on AWS EC2 Using Ansible and GitHub Actions
  • No More DynamoDB! Use Native S3 locking for Terraform State
  • How to Bring and Manage Manually Created AWS Resources Under Terraform Management
  • Iterating Cloud Resource Provisioning Using Terraform Count and For_Each Meta-Arguments
  • Terraform and Ansible Collaboration for AWS Cloud Deployment

Recent Comments

  1. Charanjit Singh on Terraform and Ansible Collaboration for AWS Cloud Deployment
  2. christinatodd2020aeaa798563 on Terraform and Ansible Collaboration for AWS Cloud Deployment
  3. Charanjit Singh on How to Set password policy in CentOS or RHEL system
  4. SAURABH on How to recover or rebuild initramfs in CentOS 7 Linux
  5. Sangita on How to Set password policy in CentOS or RHEL system

Archives

  • April 2025
  • February 2025
  • January 2025
  • August 2024
  • July 2024
  • June 2024
  • January 2024
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • September 2022
  • August 2022
  • July 2020
  • May 2020
  • February 2020
  • November 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • June 2018
  • May 2018
  • April 2018

Categories

  • Automation
  • Cloud Computing
  • Coding
  • CyberSecurity
  • Networking
  • OpenSource
  • RHEL-CentOS
  • Server Hardware
  • SLES
  • Technical Blog
  • Ubuntu
  • WSL

Blog Stats

  • 18,353 hits
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
© 2025 Welcome To Charanjit Cheema Blog | Powered by Superbs Personal Blog theme
 

Loading Comments...
 

    %d