GitHub open sources its in-house linting tool, the GitHub Super Linter, to clean up code

0

Microsoft’s GitHub open sources its in-house linting tool, the GitHub Super Linter to help developers contributing to projects built with multiple programming languages

GitHub has released the ‘Super Linter’ to help developers avoid the hassles of setting up code repositories with multiple linters. The new Super Linter is built on GitHub’s Actions tool for automating certain development workflows and aims to help developers contributing to projects built with multiple programming languages.

Super Linter is a simple combination of various linters, written in bash, to help validate your source code. According to GitHub the end goal of the tool is to 1. Prevent broken code from being uploaded to the default branch (usually master), 2. Help establish coding best practices across multiple languages, 3. Build guidelines for code layout and format, 4. Automate the process to help streamline code reviews.

What does the Super-Linter do? The super-linter finds issues and reports them to the console output. Fixes are suggested in the console output but not automatically fixed, and a status check will show up as failed on the pull request.

How to use the Super-Linter tool?

To use this GitHub Action you will need to complete the following:

  • Add the GitHub Action: Super-Linter to your current GitHub Actions workflow
  • Enjoy your more stable, and cleaner codebase
  • Check out the Wiki for customization options

In your repository, you should have a .github/workflows folder with GitHub Action similar to .github/workflows/linter.yml

This file should have the following code:


###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore:
– ‘master’

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
– name: Checkout Code
uses: actions/[email protected]

##########################
# Run Linter against codebase #
################################
– name: Lint Code Base
uses: docker://github/super-linter:v2.0.0
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_ANSIBLE: false

NOTE: Using the line:uses: docker://github/super-linter:v2.0.0 will pull the image down from DockerHub and run the GitHub Super-Linter. Using the line: uses: github/[email protected] will build and compile the GitHub Super-Linter at build time. This can be far more costly in time…

However, Microsoft GitHub’s Super-Linter tool has some Limitations and that are given below:

  • Due to being completely packaged at run time, you will not be able to update dependencies or change versions of the enclosed linters and binaries
  • Reading additional details from package.json are not read by the GitHub Super-Linter
  • Downloading additional codebases as dependencies from private repositories will fail due to lack of permissions

The Super Linter Action lets developers ‘lint’ or check their codebase using popular linters for Python, JavaScript, Go, XML, YAML, and more programming languages.

The GitHub Super Linter was built out of necessity by the GitHub Services DevOps Engineering team to maintain consistency in our documentation and code while making communication and collaboration across the company a more productive experience

says GitHub engineer Lucas Gravley

The Action also helps developers build guidelines for code layout and format, streamline code reviews, and ultimately ship cleaner code to customers and partners.

When you’ve set your repository to start running this action, any time you open a pull request, it will start linting the code case and return via the Status API. It will let you know if any of your code changes passed successfully, or if any errors were detected, where they are, and what they are.

added Gravley

If you would like to help contribute to this GitHub Action, please see CONTRIBUTING, and here is the GitHub repository for Super-Linter. What do you think about the Super-Linter tool of the GitHub? Do mention your views in the comment section below. For more news on tech and cybersecurity stay tuned at Android Rookies by subscribing to our newsletter from here

Share.

About Author

Be Ready for the challenge

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments